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

C# SQLite.SQLiteConnection类代码示例

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

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



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

示例1: CheckDupeDelDir

        /// <summary>
        /// OnDelDir delete dir from DB if its there
        /// </summary>
        /// <param name="args">input arguments</param>
        /// <returns><c>true</c> if dir was deleted</returns>
        public static bool CheckDupeDelDir(string[] args)
        {
            Log.Info("DelDir.CheckDupeDelDir");

            if (!SkipDupe.CheckSkipDupe(args))
            {
                Log.Info("DelDir.CheckDupeDelDir");
                return true;
            }

            SQLiteConnection sqlite_conn;
            SQLiteCommand sqlite_cmd;

            string dbName = ConfigReader.GetConfig("dbDupeDir");
            string db = String.Format(CultureInfo.InvariantCulture,
                @"Data Source={0};Version=3;New=False;Compress=True;", dbName);
            sqlite_conn = new SQLiteConnection(db);
            sqlite_conn.Open();
            sqlite_cmd = sqlite_conn.CreateCommand();

            string dbCommand = String.Format(CultureInfo.InvariantCulture,
                @"DELETE FROM dirDupe WHERE ReleaseName = '{0}'", Global.dupe_name);

            Log.InfoFormat("{0}", dbCommand);

            sqlite_cmd.CommandText = dbCommand;
            sqlite_cmd.ExecuteNonQuery();

            sqlite_conn.Close();

            Log.Info("DelDir.CheckDupeDelDir");

            return true;
        }
开发者ID:trippleflux,项目名称:jezatools,代码行数:39,代码来源:DelDir.cs


示例2: drExecute

        public DataRow[] drExecute(string FileData, string sSql)
        {
            DataRow[] datarows = null;
            SQLiteDataAdapter dataadapter = null;
            DataSet dataset = new DataSet();
            DataTable datatable = new DataTable();
            try
            {
                using (SQLiteConnection con = new SQLiteConnection())
                {
                    con.ConnectionString = @"Data Source=" + FileData + "; Version=3; New=False;";
                    con.Open();
                    using (SQLiteCommand sqlCommand = con.CreateCommand())
                    {
                        dataadapter = new SQLiteDataAdapter(sSql, con);
                        dataset.Reset();
                        dataadapter.Fill(dataset);
                        datatable = dataset.Tables[0];
                        datarows = datatable.Select();
                        k = datarows.Count();
                    }
                    con.Close();
                }
            }
            catch(Exception ex)
            {
            //    throw ex;
                datarows = null;
            }
            return datarows;

        }
开发者ID:SummerIntensiveC2015,项目名称:EMailChecker,代码行数:32,代码来源:sqlClass.cs


示例3: createUc

 /** public void createUc()  - create user controls (display reminders)         * 
  */
 public void createUc() 
 {
     int i = 0;
     UserControl1[] uc = new UserControl1[200];
     SQLiteConnection new_con = new SQLiteConnection(customwindow.Properties.Settings.Default.ConnectionString.ToString());
     new_con.Open();
     SQLiteCommand get = new SQLiteCommand("SELECT * FROM  reminder LIMIT 0 , 30", new_con);
     String header;
     SQLiteDataReader reader;
     reader = get.ExecuteReader();
     while (reader.Read())
     {
         //data[i,0] = new ArrayList();
         string[] str = new string[3];
         str[0]=reader[0].ToString();
         str[1]=DateTime.Parse(reader[1].ToString()).ToShortDateString();
         str[2]=DateTime.Parse(reader[5].ToString()).ToShortTimeString();
         reminderList.Add(str);
         header = String.Format("{1,-20}   {0,5}", reader[2].ToString(), DateTime.Parse(reader[1].ToString()).ToShortDateString());
         uc[i] = new UserControl1();
         uc[i].setContent(Convert.ToInt16(reader[0].ToString()), reader[3].ToString(), reader[4].ToString(), DateTime.Parse(reader[5].ToString()).ToShortTimeString() , header);
         WrapPanel1.Children.Add(uc[i]);
         i++;   
     }
     reminderlistarray = reminderList.ToArray();
 }
开发者ID:Developer-MN,项目名称:Reminder-plus,代码行数:28,代码来源:MainWindow.xaml.cs


示例4: delete_capitole

 // Functie pentru a sterge un capitol din baza de date
 public static void delete_capitole(string decizie, string title)
 {
     SQLiteConnection sqlite_conn;
     SQLiteCommand sqlite_cmd;
     string database_title = get_databaseName_tableName.get_databaseName(decizie, "capitole");
     string table_title = get_databaseName_tableName.get_tableName(decizie, "capitole");
        /* if (decizie == "info") { database_title = "Capitole.db"; table_title = "capitole";}
     if (decizie == "mate") { database_title = "Capitole_mate.db"; table_title = "capitole_mate"; }
     if (decizie == "bio") { database_title = "Capitole_bio.db"; table_title = "capitole_bio"; }*/
     try
     {
         sqlite_conn = new SQLiteConnection("Data Source=" + database_title + ";Version=3;New=False;Compress=True;");
         sqlite_conn.Open();
         sqlite_cmd = sqlite_conn.CreateCommand();
         sqlite_cmd.CommandText = "delete from " + table_title + " where titlu = @titlu_capitol";
         SQLiteParameter parameter = new SQLiteParameter("@titlu_capitol", DbType.String);
         parameter.Value = title;
         sqlite_cmd.Parameters.Add(parameter);
         sqlite_cmd.ExecuteNonQuery();
         MessageBox.Show("Lectia a fost stearsa cu succes!");
         sqlite_conn.Close();
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
开发者ID:ScorpionSpanner,项目名称:HyperLearn,代码行数:28,代码来源:Login_Class.cs


示例5: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            AddDinValues();
            AddPCBValues();
            AddRKValues();

            // create a new database connection:
            sqlite_conn = new SQLiteConnection("Data Source=ICTSupportInventory.db;Version=3;New=False;Compress=True;");

            // open the table for connection
            sqlite_conn.Open();

            // create a new SQL command:
            sqlite_cmd = sqlite_conn.CreateCommand();

            // create a new table to work with
            sqlite_cmd.CommandText = "CREATE TABLE Items (ProductType varchar(100), SerialNumber varchar(100), Location varchar(100), Availability varchar(50), Owner varchar(100), ETR varchar(100), Comments varchar(100));";

            // close the connection
            sqlite_conn.Close();

            // get values to populate all items 
            PopulateAllLists();
        }
开发者ID:karu002,项目名称:ICT,代码行数:25,代码来源:MainWindow.xaml.cs


示例6: SQLiteCommand

 public SQLiteCommand(String pCmdText, SQLiteConnection pConn)
 {
     if (pConn == null)
         throw new ArgumentNullException();
     CommandText = pCmdText;
     Connection = pConn;
 }
开发者ID:anelson,项目名称:mercury_test,代码行数:7,代码来源:Command.cs


示例7: btnSubmit_Click

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            // Let the SQLiteCommand object know our SQL-Query:
            sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;Compress=True;");
            sqlite_conn.Open();
            //UPDATE People set [email protected],stxtLname = @stxtLName,
            SQLiteCommand sqlite_cmd = new SQLiteCommand(@"Update ProgramConfig Set sPassword = @password, sEmail = @email, sSchoolName = @name,
                            sAddress = @address, sCity = @city, sState = @state, sZip = @zip, sLatitude = @latitude,
                            sLongitude = @longitude, sImageFile = @ImageFile Where id = 1", sqlite_conn);

            sqlite_cmd.Parameters.Add("@password", SqlDbType.Text).Value = parentForm.school.password;
            sqlite_cmd.Parameters.Add("@email", SqlDbType.Text).Value = parentForm.school.email;
            sqlite_cmd.Parameters.Add("@name", SqlDbType.Text).Value = parentForm.school.name;
            sqlite_cmd.Parameters.Add("@address", SqlDbType.Text).Value = parentForm.school.address;
            sqlite_cmd.Parameters.Add("@city", SqlDbType.Text).Value = parentForm.school.city;
            sqlite_cmd.Parameters.Add("@state", SqlDbType.Text).Value = parentForm.school.state;
            sqlite_cmd.Parameters.Add("@zip", SqlDbType.Text).Value = parentForm.school.zip;
            sqlite_cmd.Parameters.Add("@latitude", SqlDbType.Text).Value = parentForm.school.latitude;
            sqlite_cmd.Parameters.Add("@longitude", SqlDbType.Text).Value = parentForm.school.longitude;
            sqlite_cmd.Parameters.Add("@ImageFile", SqlDbType.Text).Value = parentForm.school.ImageFile;
            sqlite_cmd.CommandType = CommandType.Text;

            try
            {
                int i = sqlite_cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            parentForm.RefreshLogo(parentForm.school.ImageFile);
            this.Close();
        }
开发者ID:Vectar,项目名称:InSession,代码行数:33,代码来源:Setup3.cs


示例8: SearchForUser

 public SearchForUser(int iRequestType, PeopleManagement parent, SQLiteConnection sql_conn)
 {
     InitializeComponent();
     sqlite_conn = sql_conn;
     LoadUserSelect();
     frmParent = parent;
 }
开发者ID:Vectar,项目名称:InSession,代码行数:7,代码来源:SearchForUser.cs


示例9: SQLiteTransaction

 internal SQLiteTransaction(SQLiteConnection pConn)
 {
     mpConn = pConn;
     if (pConn == null)
         throw new ArgumentNullException();
     mpConn.sqlite.exec("begin transaction");
 }
开发者ID:anelson,项目名称:mercury_test,代码行数:7,代码来源:Transaction.cs


示例10: iExecuteNonQuery

        public int iExecuteNonQuery(string FileData, string sSql, int where)
        {
            int n = 0;
            //try
            //{
                using (SQLiteConnection con = new SQLiteConnection())
                {
                    if (where == 0)
                    {
                        con.ConnectionString = @"Data Source=" + FileData + "; Version=3; New=True;";
                    }
                    else
                    {
                        con.ConnectionString = @"Data Source=" + FileData + "; Version=3; New=False;";
                    }
                    con.Open();
                    using (SQLiteCommand sqlCommand = con.CreateCommand())
                    {
                        sqlCommand.CommandText = sSql;
                        n = sqlCommand.ExecuteNonQuery();
                    }
                    con.Close();
                }
            //}
            //catch
            //{
            //    n = 0;
            //}
            return n;

        }
开发者ID:SummerIntensiveC2015,项目名称:EMailChecker,代码行数:31,代码来源:sqlClass.cs


示例11: CreateOrAccessDataBase

        /// <summary>
        /// metodo cria ou acessa banco de dados sqlite carregar configs
        /// </summary>
        public void CreateOrAccessDataBase()
        {
            try
            {
                string file = AppDomain.CurrentDomain.BaseDirectory +
                              "Database\\Shamia.db";
                if (!ExistDataBase())
                {
                    Connection = new SQLiteConnection("Data Source=" + file + ";Version=3;New=True;Compress=True");
                    Connection.Open();
                    string[] config = new string[] {string.Empty, string.Empty, string.Empty};
                    // create table(s)
                    // config   => contais configurations
                    config[0] = @"create table config (port interger(4)" +
                                @",server varchar(30) primary key" +
                                @",language varchar(20))";
                    // channels => contais channels
                    config[1] = @"create table channels (channel varchar(30) primary key)";
                    // user(s)  => my login accont user(s) used login auth SSL
                    config[2] = @"create table users (nick varchar(20) primary key" +
                                @",password varchar(50))";

                    foreach (string i in config)
                    {
                        SQLiteCommand c = new SQLiteCommand(i, Connection);
                        c.ExecuteNonQuery();
                    }
                    IsDatabase = true;
                }
                else
                {
                    Connection = new SQLiteConnection("Data Source=" + file + ";Version=3" +
                                                      ";New=False;Compress=True");
                    Connection.Open();
                    IsDatabase = true;

                    // select database to list all channels and servers
                    C = Connection.CreateCommand();
                    C.CommandText = @"SELECT channel FROM channels";
                    DataReader = C.ExecuteReader();
                    while (DataReader.Read())
                    {
                        MainWindow.Configuration.Channels.Add(new TemplateChannels
                        {
                            Channels = DataReader["channel"].ToString()
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                MyDelegates.OnDebugMessageCallBack(ex.ToString());
                IsDatabase = false;
            }
            finally
            {
                if (Connection.State != ConnectionState.Closed) { Connection.Close(); }
            }
        }
开发者ID:Gnomexfire,项目名称:Shamia,代码行数:62,代码来源:SqliteSource.cs


示例12: UnDupeDir

        public static void UnDupeDir(string[] args)
        {
            Log.Info("UnDupe.UnDupeDir");

            Global.undupe_dir = args[1];
            Log.InfoFormat("Un Dupe String = '{0}'", Global.undupe_dir);

            SQLiteConnection sqlite_conn;
            SQLiteCommand sqlite_cmd;
            SQLiteDataReader sqlite_datareader;

            string dbName = ConfigReader.GetConfig("dbDupeDir");
            string db = String.Format(CultureInfo.InvariantCulture,
                @"Data Source={0};Version=3;New=False;Compress=True;", dbName);

            sqlite_conn = new SQLiteConnection(db);
            sqlite_conn.Open();
            sqlite_cmd = sqlite_conn.CreateCommand();

            string cmdText =
                String.Format(CultureInfo.InvariantCulture,
                "SELECT COUNT(*) FROM dirDupe WHERE ReleaseName = '{0}'", Global.undupe_dir);
            sqlite_cmd.CommandText = cmdText;
            sqlite_datareader=sqlite_cmd.ExecuteReader();

            int count = 0;

            while (sqlite_datareader.Read())
            {
                count = Int32.Parse(sqlite_datareader.GetValue(0).ToString());
            }

            sqlite_datareader.Close();

            if ( count > 0 )
            {
                string deleteCommand =
                    String.Format(CultureInfo.InvariantCulture,
                    @"DELETE FROM dirDupe WHERE ReleaseName = '{0}'", Global.undupe_dir);

                Log.InfoFormat("{0}", deleteCommand);

                sqlite_cmd.CommandText = deleteCommand;
                sqlite_cmd.ExecuteNonQuery();

                Console.WriteLine(
                    Format.FormatStr1ng(ConfigReader.GetConfig("msgUnDupes_ok"), 0, null));

            }
            else
            {
                Console.WriteLine(
                    Format.FormatStr1ng(ConfigReader.GetConfig("msgUnDupes_fail"), 0, null));
            }

            sqlite_conn.Close();

            Log.Info("UnDupe.UnDupeDir");
        }
开发者ID:trippleflux,项目名称:jezatools,代码行数:59,代码来源:UnDupe.cs


示例13: Adaugare_Intrebare_Load

        private void Adaugare_Intrebare_Load(object sender, EventArgs e)
        {
            btn_home = home.Size;
            btn_adauga_intrebarea = adauga_intrebarea.Size;
            if (decizie == "info")
            {
                SQLiteConnection sqlite_conn;
                SQLiteCommand sqlite_cmd;
                SQLiteDataReader sqlite_datareader;
                sqlite_conn = new SQLiteConnection("Data Source=Capitole.db;Version=3;New=False;Compress=True;");
                sqlite_conn.Open();
                sqlite_cmd = sqlite_conn.CreateCommand();
                sqlite_cmd.CommandText = "SELECT * FROM capitole";
                sqlite_datareader = sqlite_cmd.ExecuteReader();
                while (sqlite_datareader.Read())
                {
                    String myr = sqlite_datareader.GetString(0);
                    checkedListBox1.Items.Add(myr);
                }
                sqlite_conn.Close();
            }
            if (decizie == "mate")
            {
                SQLiteConnection sqlite_conn;
                SQLiteCommand sqlite_cmd;
                SQLiteDataReader sqlite_datareader;
                sqlite_conn = new SQLiteConnection("Data Source=Capitole_mate.db;Version=3;New=False;Compress=True;");
                sqlite_conn.Open();
                sqlite_cmd = sqlite_conn.CreateCommand();
                sqlite_cmd.CommandText = "SELECT * FROM capitole_mate";
                sqlite_datareader = sqlite_cmd.ExecuteReader();
                while (sqlite_datareader.Read())
                {
                    String myr = sqlite_datareader.GetString(1);
                    checkedListBox1.Items.Add(myr);
                }
                sqlite_conn.Close();
            }
            if (decizie == "bio")
            {
                SQLiteConnection sqlite_conn;
                SQLiteCommand sqlite_cmd;
                SQLiteDataReader sqlite_datareader;
                sqlite_conn = new SQLiteConnection("Data Source=Capitole_bio.db;Version=3;New=False;Compress=True;");
                sqlite_conn.Open();
                sqlite_cmd = sqlite_conn.CreateCommand();
                sqlite_cmd.CommandText = "SELECT * FROM capitole_bio";
                sqlite_datareader = sqlite_cmd.ExecuteReader();
                while (sqlite_datareader.Read())
                {
                    String myr = sqlite_datareader.GetString(1);
                    checkedListBox1.Items.Add(myr);
                }
                sqlite_conn.Close();

            }
        }
开发者ID:ScorpionSpanner,项目名称:infoeducatie2015,代码行数:57,代码来源:Adaugare_Intrebare.cs


示例14: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            // [snip] - As C# is purely object-oriented the following lines must be put into a class:

            // We use these three SQLite objects:
            SQLiteConnection sqlite_conn;
            SQLiteCommand sqlite_cmd;
            SQLiteDataReader sqlite_datareader;

            // create a new database connection:
            sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;New=True;Compress=True;");

            // open the connection:
            sqlite_conn.Open();

            // create a new SQL command:
            sqlite_cmd = sqlite_conn.CreateCommand();

            // Let the SQLiteCommand object know our SQL-Query:
            sqlite_cmd.CommandText = "CREATE TABLE test (id integer primary key, text varchar(100));";

            // Now lets execute the SQL ;D
            sqlite_cmd.ExecuteNonQuery();

            // Lets insert something into our new table:
            sqlite_cmd.CommandText = "INSERT INTO test (id, text) VALUES (1, 'Test Text 1');";

            // And execute this again ;D
            sqlite_cmd.ExecuteNonQuery();

            // ...and inserting another line:
            sqlite_cmd.CommandText = "INSERT INTO test (id, text) VALUES (2, 'Test Text 2');";

            // And execute this again ;D
            sqlite_cmd.ExecuteNonQuery();

            // But how do we read something out of our table ?
            // First lets build a SQL-Query again:
            sqlite_cmd.CommandText = "SELECT * FROM test";

            // Now the SQLiteCommand object can give us a DataReader-Object:
            sqlite_datareader = sqlite_cmd.ExecuteReader();

            // The SQLiteDataReader allows us to run through the result lines:
            while (sqlite_datareader.Read()) // Read() returns true if there is still a result line to read
            {
                // Print out the content of the text field:
                // System.Console.WriteLine(sqlite_datareader["text"]);
                string a = sqlite_datareader.GetString(0);
                MessageBox.Show(a);
            }

            // We are ready, now lets cleanup and close our connection:
            sqlite_conn.Close();
        }
开发者ID:vaibhavchaudhari,项目名称:WindowsFormsApplication2,代码行数:55,代码来源:Form1.cs


示例15: CreateConn

        public override IDbConnection CreateConn(string connString)
        {
            SQLiteConnection conn= new SQLiteConnection(connString);
               // SQLiteConnection conn = new SQLiteConnection();
               // SQLiteConnectionStringBuilder connsb = new SQLiteConnectionStringBuilder();
               // connsb.DataSource = dbName;
               // connsb.Password = "";
               // conn.ConnectionString = connsb.ToString();

            return conn;
        }
开发者ID:romanu6891,项目名称:fivemen,代码行数:11,代码来源:SqliteDataHelper.cs


示例16: pictureBox2_Click

 private void pictureBox2_Click(object sender, EventArgs e)
 {
     if (nume.Text == "" || prenume.Text == "" || repass.Text == "" || password.Text == "" || username.Text == "")
         MessageBox.Show("Trebuie sa completati toate campurile!");
     else
         if (cross.Visible == true)
             MessageBox.Show("Parolele nu corespund!");
         else
         {
             string parola_criptata;
             parola_criptata = RC4Class.RC4_Class.RC4(password.Text, "38577af7-379f-421d-ad29-cd1994521704");
             SQLiteConnection sqlite_conn;
             SQLiteCommand sqlite_cmd;
             FileStream fstream;
             sqlite_conn = new SQLiteConnection("Data Source=LOGIN.db;Version=3;New=False;Compress=True;");
             try
             {
                 sqlite_conn.Open();
                 byte[] imageBt = null;
                 fstream = new FileStream(this.image_path.Text, FileMode.Open, FileAccess.Read);
                 BinaryReader br = new BinaryReader(fstream);
                 imageBt = br.ReadBytes((int)fstream.Length);
                 sqlite_cmd = sqlite_conn.CreateCommand();
                 sqlite_cmd.CommandText = "INSERT INTO utilizatori(nume, prenume, username, password,avatar) " +
                                                             "Values('" + nume.Text + "', '" + prenume.Text + "', '" + username.Text + "', '" + parola_criptata + "', @IMG);";
                 SQLiteParameter parameter = new SQLiteParameter("@IMG", System.Data.DbType.Binary);
                 SQLiteParameter parameter1 = new SQLiteParameter("@nume", System.Data.DbType.String);
                 SQLiteParameter parameter2 = new SQLiteParameter("@prenume", System.Data.DbType.String);
                 SQLiteParameter parameter3 = new SQLiteParameter("@username", System.Data.DbType.String);
                 SQLiteParameter parameter4 = new SQLiteParameter("@parola", System.Data.DbType.String);
                 parameter.Value = imageBt;
                 parameter1.Value = nume.Text;
                 parameter2.Value = prenume.Text;
                 parameter3.Value = username.Text;
                 parameter4.Value = parola_criptata;
                 sqlite_cmd.Parameters.Add(parameter);
                 sqlite_cmd.Parameters.Add(parameter1);
                 sqlite_cmd.Parameters.Add(parameter2);
                 sqlite_cmd.Parameters.Add(parameter3);
                 sqlite_cmd.Parameters.Add(parameter4);
                 sqlite_cmd.ExecuteNonQuery();
                 sqlite_conn.Close();
                 MessageBox.Show("Tocmai te-ai inscris in baza noastra de date!");
                 Login lg = new Login();
                 this.Hide();
                 lg.Show();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
 }
开发者ID:ScorpionSpanner,项目名称:HyperLearn,代码行数:53,代码来源:Inregistrare.cs


示例17: CppSqlGenerationVisitor

 public CppSqlGenerationVisitor(Settings sett, Graph rooms)
 {
     m_settings = sett;
       m_graph = rooms;
       //System.Diagnostics.Process proc = new System.Diagnostics.Process();
       //proc.StartInfo.FileName = "sqlite.exe";
       m_conn = new SQLiteConnection("Data Source=adventure.hac;Version=3;New=True;Compress=True");
       m_conn.Open();
       m_cmd = m_conn.CreateCommand();
       m_propid = -1;
       m_statpropid = -1;
       m_respid = 0;
 }
开发者ID:captain-mayhem,项目名称:captainsengine,代码行数:13,代码来源:CppSqlGenerationVisitor.cs


示例18: InitConnection

        private static void InitConnection()
        {
            Console.WriteLine(Application.UserAppDataPath);
            string dataPath = Application.UserAppDataPath + "\\" + "data";

            if (Directory.Exists(dataPath) && File.Exists(dataPath + "\\database.db"))
            {
                sqlConnection =
                    new SQLiteConnection(
                        "Data Source=" + dataPath + "\\database.db" +
                        ";Version=3;New=False;Compress=True;UTF8Encoding=True;");
                sqlConnection.Open();

                sqlCommand = sqlConnection.CreateCommand();
            }
            else
            {
                if (!Directory.Exists(dataPath))
                {
                    Directory.CreateDirectory(dataPath);

                    ClearFileUnderPath(dataPath);
                }
                sqlConnection =
                    new SQLiteConnection(
                        "Data Source=" + dataPath + "\\database.db" +
                        ";Version=3;New=True;Compress=True;UTF8Encoding=True;");
                sqlConnection.Open();

                ClearFileUnderPath(dataPath);

                sqlCommand = sqlConnection.CreateCommand();

                sqlCommand.CommandText = "create table movie(fileLocation nvarchar primary key)";
                sqlCommand.ExecuteNonQuery();
                sqlCommand.CommandText = "create table music(fileLocation nvarchar primary key)";
                sqlCommand.ExecuteNonQuery();
                sqlCommand.CommandText = "create table file(fileLocation nvarchar primary key)";
                sqlCommand.ExecuteNonQuery();
            }

            //string sql = "select count(*) as c from sqlite_master where type ='table' and name ='movie'";

            //sqlCommand.CommandText =
            //    "create table movie(fileLocation nvarchar primary key)";
            //sqlCommand.ExecuteNonQuery();
            //sqlCommand.CommandText = "create table music(fileLocation nvarchar primary key)";
            //sqlCommand.ExecuteNonQuery();
            //sqlCommand.CommandText = "create table file(fileLocation nvarchar primary key)";
            //sqlCommand.ExecuteNonQuery();
        }
开发者ID:ZhuGongpu,项目名称:CloudX,代码行数:51,代码来源:SqliteUtils.cs


示例19: Setup1

 public Setup1(frmMain Main)
 {
     parentForm = Main;
     this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     InitializeComponent();
     sqlite_conn = sqlite_conn = new SQLiteConnection("Data Source=database.db;Version=3;Compress=True;");
     txtPassword.Text = parentForm.school.password;
     txtPassConfirm.Text = parentForm.school.password;
     txtAdminEmail.Text= parentForm.school.email;
     txtSchoolName.Text= parentForm.school.name;
     txtAddress.Text= parentForm.school.address;
     txtCity.Text= parentForm.school.city;
     txtState.Text= parentForm.school.state;
     txtZip.Text= parentForm.school.zip;
 }
开发者ID:Vectar,项目名称:InSession,代码行数:15,代码来源:Setup1.cs


示例20: CreateCommand

        /// <summary>
        /// Simplify the creation of a SQLite command object by allowing
        /// a CommandType and Command Text to be provided
        /// </summary>
        /// <remarks>
        /// e.g.:  
        ///  SQLiteCommand command = CreateCommand(conn, CommandType.Text, "Select * from Customers");
        /// </remarks>
        /// <param name="connection">A valid SQLiteConnection object</param>
        /// <param name="commandType">CommandType (TableDirect, Text)</param>
        /// <param name="commandText">CommandText</param>
        /// <returns>A valid SQLiteCommand object</returns>
        public static SQLiteCommand CreateCommand(SQLiteConnection connection, CommandType commandType, string commandText )
        {
            if( connection == null ) throw new ArgumentNullException( "connection" );

            if( commandType == CommandType.StoredProcedure ) throw new ArgumentException("Stored Procedures are not supported.");

            // If we receive parameter values, we need to figure out where they go
            if ((commandText == null) && (commandText.Length<= 0)) throw new ArgumentNullException( "Command Text" );

            // Create a SQLiteCommand
            SQLiteCommand cmd = new SQLiteCommand(commandText, connection );
            cmd.CommandType = CommandType.Text ;

            return cmd;
        }
开发者ID:bnantz,项目名称:Mobile-Data-Access-Application-Block,代码行数:27,代码来源:SqlLite.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# FireSpider.ConvertSetting类代码示例发布时间:2022-05-24
下一篇:
C# SQLite.SQLiteCommand类代码示例发布时间: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