IntQuery() public method

执行查询SQL,返回受影响行数
public IntQuery ( string sql, SQLiteParameter parameters ) : int
sql string sql语句
parameters System.Data.SQLite.SQLiteParameter 参数
return int
コード例 #1
0
ファイル: ConfigData.cs プロジェクト: JimmyFung/DesktopHelper
 public int ClearConfigWebsite()
 {
     int result = 0;
     try
     {
         string sqlString = @"delete from t_website_config";
         SqlAction action = new SqlAction();
         result = action.IntQuery(sqlString, null);
     }
     catch
     {
     }
     return result;
 }
コード例 #2
0
 public int ClearWebsiteData()
 {
     int result = 0;
     try
     {
         string sql = "delete from t_website";
         SqlAction action = new SqlAction();
         result = action.IntQuery(sql, null);
     }
     catch (Exception ex)
     {
         log.WriteLog(ex.ToString());
     }
     return result;
 }
コード例 #3
0
ファイル: ConfigData.cs プロジェクト: JimmyFung/DesktopHelper
        public int AddConfigWebsite(string webOrder, string name, string url)
        {
            int result = 0;
            try
            {
                string sql = "INSERT INTO t_website_config(WebOrder,Name,URL)values(@WebOrder,@Name,@URL)";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@WebOrder",webOrder),
                                         new SQLiteParameter("@Name",name),
                                         new SQLiteParameter("@URL",url)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #4
0
        public int AddReminder(Reminder reminder)
        {
            int result = 0;
            try
            {
                string sql = "INSERT INTO t_tixing(Id,Time,Info)values(@Id,@Time,@Info)";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Id",reminder.ReminderId),
                                         new SQLiteParameter("@Time",reminder.ReminderTime.ToString("yyyy-MM-dd HH:mm:ss")),
                                         new SQLiteParameter("@Info",reminder.ReminderInfo)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #5
0
        public int AddNotepad(string title, string content)
        {
            int result = 0;
            try
            {
                string sql = "INSERT INTO t_notepad(Title,CreateTime,UpdateTime,Content)values(@Title,@CreateTime,@UpdateTime,@Content)";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Title",title),
                                         new SQLiteParameter("@CreateTime",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                                         new SQLiteParameter("@UpdateTime",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                                         new SQLiteParameter("@Content",content)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception)
            {
                throw;
            }
            return result;
        }
コード例 #6
0
ファイル: ConfigData.cs プロジェクト: JimmyFung/DesktopHelper
        public int UpdateConfig(string name, string value)
        {
            int result = 0;
            try
            {
                string sql = "update t_config set Value=@Value where  Name=@Name";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Name",name),
                                         new SQLiteParameter("@Value",value)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #7
0
        public int AddTimedEvent(TimedEvent timerEvent)
        {
            int result = 0;
            try
            {
                string sql = "INSERT INTO t_dingshi(Id,Frequency,Time,ExecEvents,FilePath)values(@Id,@Frequency,@Time,@ExecEvents,@FilePath)";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Id",timerEvent.Id),
                                         new SQLiteParameter("@Frequency",timerEvent.Frequency),
                                         new SQLiteParameter("@Time",timerEvent.Time.ToString("yyyy-MM-dd HH:mm:ss")),
                                         new SQLiteParameter("@ExecEvents",timerEvent.ExecEvents),
                                         new SQLiteParameter("@FilePath",timerEvent.FilePath)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #8
0
        public int UpdateNotepad(string createTime, string title, string content)
        {
            int result = 0;
            try
            {
                string sql = "update t_notepad set Title=@Title,UpdateTime=@UpdateTime,Content=@Content where CreateTime=@CreateTime";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Title",title),
                                         new SQLiteParameter("@CreateTime",createTime),
                                         new SQLiteParameter("@UpdateTime",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                                         new SQLiteParameter("@Content",content)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception)
            {
                throw;
            }
            return result;
        }
コード例 #9
0
        public int DeleteTimedEvent(int id)
        {
            int result = 0;
            try
            {
                string sql = string.Empty;
                SQLiteParameter[] parameters = null;

                if (-1 == id)
                {
                    sql = "delete from t_dingshi where Frequency='仅一次' and Time < @Time";
                    parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Time",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                                         };
                }
                else
                {
                    sql = "delete from t_dingshi where Id = @Id";
                    parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Id",id)
                                         };
                }
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #10
0
        public int DeleteReminderExpired(DateTime now)
        {
            int result = 0;
            try
            {
                string sql = "delete from t_tixing where Time < @Time";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Time",now.ToString("yyyy-MM-dd HH:mm:ss"))
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #11
0
        public int DeleteReminderById(int id)
        {
            int result = 0;
            try
            {
                string sql = "delete from t_tixing where Id = @Id";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Id",id)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return result;
        }
コード例 #12
0
        public int DeleteNotepad(string createTime)
        {
            int result = 0;
            try
            {
                string sql = "delete from t_notepad where CreateTime=@CreateTime";
                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@CreateTime",createTime)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception)
            {

                throw;
            }
            return result;
        }
コード例 #13
0
        public int InsertWebsiteData(Website website)
        {
            int result = 0;
            try
            {
                string sql = "INSERT INTO t_website(WebOrder,Type,Name,URL)values(@WebOrder,@Type,@Name,@URL)";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@WebOrder",website.Index),
                                         new SQLiteParameter("@Type",website.Type),
                                         new SQLiteParameter("@Name",website.Name),
                                         new SQLiteParameter("@URL",website.Url)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return result;
        }
コード例 #14
0
        public int InsertCityData(City city)
        {
            int result = 0;
            try
            {
                string sql = "INSERT INTO t_city(Name,ShengParent,ShiParent,Code)values(@Name,@ShengParent,@ShiParent,@Code)";

                SQLiteParameter[] parameters = new SQLiteParameter[]{
                                         new SQLiteParameter("@Name",city.Name),
                                         new SQLiteParameter("@ShengParent",city.ShengParent),
                                         new SQLiteParameter("@ShiParent",city.ShiParent),
                                         new SQLiteParameter("@Code",city.Code)
                                         };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return result;
        }