• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SQLiteDatabase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: checkAccount

        /// <summary>
        ///     Checks whether a specified account exists and whether the password supplied
        ///     is correct
        /// </summary>
        /// <param name="id">The ID of the student/teacher - Corresponds to the id field
        /// in the DB</param>
        /// <param name="pass">The password to check as a string</param>
        /// <param name="stuteach">A string containing "students" or "teachers"</param>
        /// <returns>true when account is correct, false otherwise</returns>
        public static bool checkAccount(int id, string pass, string stuteach)
        {
            SQLiteDatabase db = new SQLiteDatabase();
            string dbPass = db.ExecuteScalar(string.Format("SELECT hash FROM {0} WHERE id={1};", stuteach, id));
            string passHash = Password.hashAsString(pass);

            if (dbPass == passHash)
                return true;

            return false;
        }
开发者ID:notexactlyawe,项目名称:SpellingBee,代码行数:20,代码来源:AccountControl.cs


示例17: Main

        static void Main()
        {
            //Needed for log4net to read from the app.config
            XmlConfigurator.Configure();

            var db = new SQLiteDatabase(@"D:\Fun\Code\GitHub\Logger\Database\MyLogs.db;");
            //Clearing previous test data
            db.ClearTable("Log");

            AddFakeData();
            RetrieveAndDisplayData(db);
        }
开发者ID:Kaizen321,项目名称:Logger,代码行数:12,代码来源:Program.cs


示例18: Form1

        public Form1(int selectedMail, int action)
        {
            InitializeComponent();

            // action:
            // 0 = new mail
            // 1 = reply
            // 2 = forward
            // 3 = send public key
            string selectedSender = "unknown";
            string selectedSubject = "unknown";
            string selectedBody = "unknown";
            if (action == 1 || action == 2)
            {
                SQLiteDatabase db = new SQLiteDatabase();
                DataTable Mail;
                String query = "select Sender \"Sender\", Subject \"Subject\",";
                query += "Body \"Body\", Timestamp \"Timestamp\"";
                query += "from Mails ";
                query += "where ID = " + selectedMail + ";";
                Mail = db.GetDataTable(query);
                foreach (DataRow r in Mail.Rows)
                {
                    selectedSender = r["Sender"].ToString();
                    selectedSubject = r["Subject"].ToString();
                    selectedBody = r["Body"].ToString();
                }
            }

            switch (action)
            {
                case 1: // Reply
                    textBoxTo.Text = selectedSender;
                    textBoxSub.Text = "RE: " + selectedSubject;
                    break;
                case 2: // Forward
                    textBoxTo.Text = "";
                    textBoxSub.Text = "FW: " + selectedSubject;
                    break;
                case 3:
                    textBoxSub.Text = "My public key";
                    textBoxBody.Text = Properties.Settings.Default.RSAPublic;
                    textBoxPublicKey.Visible = false;
                    label1.Visible = false;
                    checkBoxEncrypt.Visible = false;
                    checkBoxRSA.Visible = false;
                    break;
                default:
                    textBoxTo.Text = "";
                    textBoxSub.Text = "";
                    break;
            }
        }
开发者ID:okdios,项目名称:Mail-client,代码行数:53,代码来源:Form1.cs


示例19: Vault

        //
        // PRIVATE and INTERNAL
        //
        internal Vault()
        {
            databaseFileName = PLUGIN_FOLDER + Path.DirectorySeparatorChar + "vault.db";
            debug("database file location:" + databaseFileName);

            Dictionary<string, string > options = new Dictionary<string, string>();
            options["Data Source"] = databaseFileName;
            options["New"] = "True";
            database = new SQLiteDatabase(options);

            setup();
        }
开发者ID:FourFourHero,项目名称:TDSM-Vault,代码行数:15,代码来源:Vault.cs


示例20: RetrieveAndDisplayData

        private static void RetrieveAndDisplayData(SQLiteDatabase db)
        {
            var results = db.GetDataTable("SELECT * From Log");

            //TODO: Use generics instead. Please don't go out there kicking a cute puppy because of this code :(
            foreach (DataRow item in results.Rows)
            {
                Console.WriteLine("Level: {0} - Location: {1} - Date and Time: {2}",
                                item["Level"].ToString().ToUpper(), item["Location"], item["TimeStamp"]);
                Console.WriteLine("Message: \n{0} \n", item["Message"]);
            }
            Console.ReadLine();
        }
开发者ID:Kaizen321,项目名称:Logger,代码行数:13,代码来源:Program.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SR类代码示例发布时间:2022-05-24
下一篇:
C# SQLiteConnectionFlags类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap