DataTableQuery() public method

执行查询SQL,返回查询结果表
public DataTableQuery ( string sql, SQLiteParameter parameters ) : DataTable
sql string sql语句
parameters System.Data.SQLite.SQLiteParameter 参数
return System.Data.DataTable
Ejemplo n.º 1
0
 /// <summary>
 /// 获取固定网址数据
 /// </summary>
 /// <returns></returns>
 public DataTable GetFixedWebsite()
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select *  from t_website order by WebOrder";
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, null);
     }
     catch
     {
     }
     return data;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取当前“定时表”数据
 /// </summary>
 /// <returns></returns>
 public DataTable GetDingshi()
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select *  from t_dingshi";
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, null);
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
     return data;
 }
Ejemplo n.º 3
0
 public DataTable GetCityData(CityType type, string parent)
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = string.Empty;
         SQLiteParameter[] parameters = null;
         City city = new City();
         switch (type)
         {
             case CityType.Sheng:
                 sqlString = "select Name  from t_city where ShengParent IS NULL and ShiParent IS NULL and Code IS NULL";
                 break;
             case CityType.Shi:
                 sqlString = "select Name  from t_city where ShengParent=@ShengParent and ShiParent IS NULL and Code IS NULL";
                 parameters = new SQLiteParameter[]{
                                  new SQLiteParameter("@ShengParent",parent)
                                  };
                 break;
             case CityType.Xian:
                 sqlString = "select Name,Code  from t_city where ShiParent=@ShiParent";
                 parameters = new SQLiteParameter[]{
                                  new SQLiteParameter("@ShiParent",parent)
                                  };
                 break;
         }
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, parameters);
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
     return data;
 }
Ejemplo n.º 4
0
        public DataTable GetCityInfoByCode(string code)
        {
            DataTable data = new DataTable();
            try
            {
                string sqlString = string.Format("select *  from t_city where Code='{0}'", code);

                SqlAction action = new SqlAction();
                data = action.DataTableQuery(sqlString, null);
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return data;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取当前"网址设置表"数据
 /// </summary>
 /// <returns></returns>
 public DataTable GetWebsiteConfig()
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select *  from t_website_config order by WebOrder";
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, null);
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
     return data;
 }
Ejemplo n.º 6
0
        public DataTable GetTimedEvents()
        {
            DataTable data = new DataTable();
            try
            {
                string sqlString = @"select *  from t_dingshi";

                SqlAction action = new SqlAction();
                data = action.DataTableQuery(sqlString, null);
            }
            catch
            {
            }
            return data;
        }
Ejemplo n.º 7
0
 public DataTable GetRiliDataByMonth(int year,int month)
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select *  from t_rili where Yangli like '" + string.Format("{0}年{1}月",year,month) + "%' order by Yangli";
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, null);
     }
     catch
     {
     }
     return data;
 }
Ejemplo n.º 8
0
 public DataTable GetReminders(DateTime now)
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select *  from t_tixing where Time >= @Time order by Id";
         SQLiteParameter[] parameters = new SQLiteParameter[]{
                                  new SQLiteParameter("@Time",now.ToString("yyyy-MM-dd HH:mm:ss"))
                                  };
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, parameters);
     }
     catch
     {
     }
     return data;
 }
Ejemplo n.º 9
0
 public DataTable GetNotepadByCreateTime(string createTime)
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select CreateTime,Title,Content from t_notepad  where CreateTime=@CreateTime";
         SQLiteParameter[] parameters = new SQLiteParameter[]{
                                  new SQLiteParameter("@CreateTime",createTime)
                                  };
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, parameters);
     }
     catch (Exception)
     {
         throw;
     }
     return data;
 }
Ejemplo n.º 10
0
        public DataTable GetNotepad()
        {
            DataTable data = new DataTable();
            try
            {
                string sqlString = @"select CreateTime,Title  from t_notepad order by UpdateTime";

                SqlAction action = new SqlAction();
                data = action.DataTableQuery(sqlString, null);
            }
            catch (Exception)
            {
                throw;
            }
            return data;
        }
Ejemplo n.º 11
0
 public DataTable GetConfig()
 {
     DataTable data = new DataTable();
     try
     {
         string sqlString = @"select *  from t_config";
         SqlAction action = new SqlAction();
         data = action.DataTableQuery(sqlString, null);
     }
     catch
     {
     }
     return data;
 }