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


C# SQLiteDatabase类代码示例

本文整理汇总了C#中SQLiteDatabase的典型用法代码示例。如果您正苦于以下问题:C# SQLiteDatabase类的具体用法?C# SQLiteDatabase怎么用?C# SQLiteDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SQLiteDatabase类属于命名空间,在下文中一共展示了SQLiteDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMessages

        public static RiderMessage[] GetMessages(string userId,string raceId)
        {
            List<RiderMessage> messages = new List<RiderMessage>();
              SQLiteDatabase db = new SQLiteDatabase();
              string sql = "select m.RaceId, u.userid,u.username, m.message, m.SendTime " +
                    "from cycli_rider_messages m, cycli_riders u " +
                    "where m.SenderId = u.UserId and " +
                    "m.RaceId = @r " +
                      "order by m.SendTime";

              DataTable dt = db.GetDataTable(sql,"@r",raceId, "@t", "fromTime");
              db.Close();
              foreach (DataRow dr in dt.Rows)
              {
            RiderMessage message = new RiderMessage();
            message.SenderId = (string)dr["userid"];
            message.Sender = (string)dr["username"];
            message.RaceId = (string)dr["RaceId"];
            message.Message = (string)dr["Message"];
            message.SendTime = (long)(int)dr["SendTime"];
            messages.Add(message);
              }

              return messages.ToArray();
        }
开发者ID:Cycli,项目名称:Cycli,代码行数:25,代码来源:RiderMessage.cs

示例2: SQLiteTransaction

 public SQLiteTransaction(SQLiteDatabase database, IsolationLevel level, SQLiteSettings settings)
 {
   _database = database;
   _settings = settings;
   _connection = _database.ConnectionPool.GetConnection();
   _transaction = _connection.BeginTransaction(level);
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:7,代码来源:SQLiteTransaction.cs

示例3: itempage1

        public itempage1()
        {
            InitializeComponent();
            try
            {
                var db = new SQLiteDatabase();
                DataTable recipe;
                String query = "select ID \"id\", NAME \"Description\",";
                query += "CLIP \"Text\"";
                query += "from CLIPBOARD;";
                recipe = db.GetDataTable(query);
                // The/ results can be directly applied to a DataGridView control
                //dataGrid.DataContext = recipe;
                /*
                // Or looped through for some other reason
                foreach (DataRow r in recipe.Rows)
                {
                    MessageBox.Show(r["Name"].ToString());
                    MessageBox.Show(r["Description"].ToString());
                    MessageBox.Show(r["Prep Time"].ToString());
                    MessageBox.Show(r["Cooking Time"].ToString());
                }

                */
            }
            catch (Exception fail)
            {
                String error = "The following error has occurred:\n\n";
                error += fail.Message.ToString() + "\n\n";
                MessageBox.Show(error);
                this.Close();
            }
        }
开发者ID:adamk8875,项目名称:Work-console,代码行数:33,代码来源:itempage1.xaml.cs

示例4: DumpSqlite

        static void DumpSqlite(string filename)
        {
            Serializer s = new Serializer();
            try
            {
                var db = new SQLiteDatabase(filename);
                List <String> tableList = db.GetTables();
                List<SerializableDictionary<string, string>> dictList = new List<SerializableDictionary<string, string>>();
                foreach (string table in tableList)
                    {
                        String query = string.Format("select * from {0};", table);
                        DataTable recipe = db.GetDataTable(query);
                        foreach (DataRow r in recipe.Rows)
                            {
                                SerializableDictionary<string, string> item = new SerializableDictionary<string, string>();
                                foreach (DataColumn c in recipe.Columns)
                                    {
                                        item[c.ToString()] = r[c.ToString()].ToString();
                                    }
                                dictList.Add(item);
                            }
                        s.Serialize(string.Format("{0}.xml", table), dictList, table);
                        dictList.Clear();
                    }

            }
            catch (Exception fail)
            {
                String error = "The following error has occurred:\n\n";
                error += fail.Message + "\n\n";
            }
        }
开发者ID:nalicexiv,项目名称:ffxivlib,代码行数:32,代码来源:Program.cs

示例5: LoadAny

        public static Rider LoadAny(string userId)
        {
            Rider thisRider = null;
              SQLiteDatabase db = new SQLiteDatabase();
              string sql = @"select r.UserId as UserId, r.Username as Username, r.BikeWheelSizeMm as BikeWheelSizeMm, r.Turbo as Turbo, " +
            "r.TurboIsCalibrated as TurboIsCalibrated, r.EstimatedPower as EstimatedPower " +
            "From cycli_riders r " +
            "where [email protected] and AccountStatus='Active'" +
            "union " +
            "select r.UserId as UserId, r.Username as Username, 700 as BikeWheelSizeMm, null as Turbo, " +
            "'False' as TurboIsCalibrated, 'False' as EstimatedPower " +
            "From cycli_virtual_riders r " +
            "where [email protected] and Status='Active'";

             // Only load active accounts
               DataTable dtUser = db.GetDataTable(sql, "@u1", userId, "@u2",userId);
              if (dtUser.Rows.Count > 0)
              {
            DataRow dr = dtUser.Rows[0];
            thisRider = new Rider();
            thisRider.UserName = dr.Field<string>("Username");
            thisRider.UserId= dr.Field<string>("UserId");
            thisRider.BikeWheelSizeMm = (int)dr.Field<long>("BikeWheelSizeMm");
            thisRider.CurrentTurbo = dr.Field<string>("Turbo");
            thisRider.TurboIsCalibrated = (dr.Field<string>("TurboIsCalibrated") == bool.TrueString);
            thisRider.EstimatedPower = (dr.Field<string>("EstimatedPower") == bool.TrueString);

              }
              db.Close();
              return thisRider;
        }
开发者ID:Cycli,项目名称:Cycli,代码行数:31,代码来源:Rider.cs

示例6: Load

 public static Friend[] Load(string userId)
 {
     List<Friend> friends = new List<Friend>();
       SQLiteDatabase db = new SQLiteDatabase();
       string sql = @"select * from (select r.UserId as UserId, r.UserName as UserName, " +
       "r.Turbo, t.Power_Model_C1, t.Power_Model_C2, t.Power_Model_C3, " +
       "f.Status as Status " +
               "from cycli_riders r, cycli_friends f, cycli_turbos t " +
           "where f.UserId = '" + userId + "' and r.UserId=f.FriendId " +
           "and r.Turbo = t.Type " +
           "union " +
           "select r.UserId as UserId, r.UserName as UserName, "+
           "r.Turbo, t.Power_Model_C1, t.Power_Model_C2, t.Power_Model_C3, " +
           "f.Status as Status " +
               "from cycli_riders r, cycli_friends f, cycli_turbos t " +
           "where f.FriendId= '" + userId + "' and r.UserId=f.UserId "+
           "and r.Turbo = t.Type " +
           ") order by UserName";
       DataTable dtFriends = db.GetDataTable(sql);
       foreach (DataRow dr in dtFriends.Rows)
       {
     Friend f = new Friend()
     {
       UserId = dr.Field<string>("UserId"),
       UserName = dr.Field<string>("UserName"),
       Turbo = dr.Field<string>("Turbo"),
       Coefficients = new double[]{dr.Field<double>("Power_Model_C1"),dr.Field<double>("Power_Model_C2"),dr.Field<double>("Power_Model_C3")},
       Status = (string)dr["Status"]
     };
     friends.Add(f);
       }
       return friends.ToArray();
 }
开发者ID:Cycli,项目名称:Cycli,代码行数:33,代码来源:Friend.cs

示例7: SQLiteVdbe

        /// <summary>
        /// Creates new instance of SQLiteVdbe class by compiling a statement
        /// </summary>
        /// <param name="query"></param>
        /// <returns>Vdbe</returns>
        public SQLiteVdbe(SQLiteDatabase db, String query)
        {
            vm = null;

            // prepare and compile
            Sqlite3.sqlite3_prepare_v2(db.Connection(), query, query.Length, ref vm, 0);
        }
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:12,代码来源:SQLiteVdbe.cs

示例8: InitializeTables

 private void InitializeTables(SQLiteDatabase db)
 {
     db.ExecuteNonQuery("BEGIN EXCLUSIVE");
     for(int i = 0; i < CREATE_Commands.Length; i++)
     {
         db.ExecuteNonQuery(CREATE_Commands[i]);
     }
 }
开发者ID:RainsSoft,项目名称:CsharpSQLite,代码行数:8,代码来源:Stress.cs

示例9: Instance

 public static SQLiteDatabase Instance()
 {
     if (instance == null)
     {
         instance = new SQLiteDatabase();
     }
     return instance;
 }
开发者ID:greenqloud,项目名称:qloudsync,代码行数:8,代码来源:SQLiteDataBase.cs

示例10: frm_Main

        public frm_Main()
        {
            connect = new ConnectProlog();
            InitializeComponent();

            m_resources = new Resources();
            m_database = new SQLiteDatabase("laptop.s3db");
        }
开发者ID:cs-team-uit,项目名称:Laptop_Advisor,代码行数:8,代码来源:Form1.cs

示例11: EmployeeExists

 public static bool EmployeeExists(string employeeID, SQLiteDatabase sql)
 {
     // notify user if card wasn't found
     if (sql.GetDataTable("select * from employees where employeeID=" + employeeID.Trim() + ";").Rows.Count == 1)
         return true;
     else
         return false;
 }
开发者ID:ExtraordinaryBen,项目名称:BarcodeClocking,代码行数:8,代码来源:Helper.cs

示例12: FormWarmup

 public FormWarmup(SQLiteDatabase db)
 {
     InitializeComponent();
     dbsqlite = db;
     loadconfig();
     //load from DB
     LoadPhysical();
 }
开发者ID:ricain59,项目名称:fortaff,代码行数:8,代码来源:FormWarmup.cs

示例13: ResetDatabases

        public void ResetDatabases()
        {
            string password = Settings.Default.Password;

            if (password.Length > 0)
                password = SecurityExtensions.DecryptString(password, Encoding.Unicode.GetBytes(Settings.Default.Entropy)).ToInsecureString();

            worldDatabase = new WorldDatabase(Settings.Default.Host, Settings.Default.Port, Settings.Default.User, password, Settings.Default.Database);
            sqliteDatabase = new SQLiteDatabase("Resources/sqlite_database.db");
        }
开发者ID:RavenB,项目名称:OpenTools,代码行数:10,代码来源:SAI-Editor-Manager.cs

示例14: DataAccess

 public DataAccess(string filename)
 {
     this.filename = filename;
     database = new SQLiteDatabase(filename);
     //Create database structure for new files
     if (!File.Exists(filename))
     {
         CreateNewRunFile(filename);
     }
 }
开发者ID:NoxHarmonium,项目名称:enform,代码行数:10,代码来源:DataAccess.cs

示例15: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string sql = "select * from userInfo order by id desc limit 200";
         SQLiteDatabase db = new SQLiteDatabase();
         var datatable = db.GetDataTable(sql);
         rptUserInfo.DataSource = datatable;
         rptUserInfo.DataBind();
     }
 }
开发者ID:delicious28,项目名称:xss,代码行数:11,代码来源:gride.aspx.cs


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