本文整理汇总了C#中System.Data.OleDb.OleDbCommand.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbCommand.GetValue方法的具体用法?C# OleDbCommand.GetValue怎么用?C# OleDbCommand.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbCommand
的用法示例。
在下文中一共展示了OleDbCommand.GetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getDataAry
public virtual object[] getDataAry(string argString)
{
this.rState = 0;
string cmdText = argString;
object[] objArray = null;
try
{
string connStr = this.connStr;
string argRoutestr = cls.getParameter(connStr, "Data Source");
string newValue = HttpContext.Current.Server.MapPath(cls.getActualRoute(argRoutestr));
OleDbConnection connection = new OleDbConnection(connStr.Replace(argRoutestr, newValue));
connection.Open();
OleDbDataReader reader = new OleDbCommand(cmdText, connection).ExecuteReader();
int fieldCount = reader.FieldCount;
object[,] objArray2 = null;
while (reader.Read())
{
objArray2 = new object[fieldCount, 2];
for (int i = 0; i < fieldCount; i++)
{
objArray2[i, 0] = reader.GetName(i);
objArray2[i, 1] = reader.GetValue(i);
}
objArray = cls.mergeAry(objArray, objArray2);
}
reader.Close();
connection.Close();
}
catch (Exception exception)
{
this.rState = 1;
objArray = null;
this.eMessage = exception.Message;
}
return objArray;
}
示例2: getDataAry
public virtual Dictionary<string, object>[] getDataAry(string strSQL)
{
this.rState = 0;
Dictionary<string, object>[] rsArray = null;
if ((string)strSQL != "")
{
try
{
OleDbConnection connection = new OleDbConnection(this.connStr);
connection.Open();
OleDbDataReader reader = new OleDbCommand(strSQL, connection).ExecuteReader();
Dictionary<int, object> rsList = new Dictionary<int, object>();
int fieldCount = reader.FieldCount;
int num = 0;
while (reader.Read())
{
Dictionary<string, object> rec = new Dictionary<string, object>();
for (int i = 0; i < fieldCount; i++)
{
rec.Add(reader.GetName(i), reader.GetValue(i));
}
rsList.Add(num, rec);
num ++;
}
reader.Close();
connection.Close();
rsArray = new Dictionary<string, object>[num];
foreach (var kv in rsList)
{
rsArray[kv.Key] = (Dictionary<string, object>)kv.Value;
}
}
catch (Exception exception)
{
this.rState = 1;
var errMsg = new Dictionary<string, object>();
errMsg.Add("msg", "Operate DB Error: " + exception.Message);
rsArray = new Dictionary<string, object>[] { errMsg };
this.eMessage = exception.Message;
}
}
else
{
this.rState = 999;
}
return rsArray;
}