当前位置: 首页>>代码示例>>C#>>正文


C# OleDbCommand.GetValue方法代码示例

本文整理汇总了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;
 }
开发者ID:dengfan,项目名称:jtbc-plus,代码行数:36,代码来源:access.cs

示例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;
        }
开发者ID:liuzhenwei,项目名称:VS,代码行数:48,代码来源:access.cs


注:本文中的System.Data.OleDb.OleDbCommand.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。