Пример #1
0
 public virtual string getFieldList(string argString)
 {
     string cmdText = argString;
     string argObject = "";
     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;
         for (int i = 0; i < fieldCount; i++)
         {
             argObject = argObject + reader.GetName(i) + "|";
         }
         if (!cls.isEmpty(argObject))
         {
             argObject = cls.getLRStr(argObject, "|", "leftr");
         }
         reader.Close();
         connection.Close();
     }
     catch (Exception exception)
     {
         argObject = "";
         this.eMessage = exception.Message;
     }
     return argObject;
 }
Пример #2
0
 public virtual string getFieldList(string argString)
 {
     string cmdText = argString;
     string argObject = "";
     try
     {
         OleDbConnection connection = new OleDbConnection(this.connStr);
         connection.Open();
         OleDbDataReader reader = new OleDbCommand(cmdText, connection).ExecuteReader();
         int fieldCount = reader.FieldCount;
         for (int i = 0; i < fieldCount; i++)
         {
             argObject = argObject + reader.GetName(i) + "|";
         }
         reader.Close();
         connection.Close();
     }
     catch (Exception exception)
     {
         argObject = "";
         this.eMessage = exception.Message;
     }
     return argObject;
 }
Пример #3
0
 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;
 }
Пример #4
0
		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;
        }