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


C# SQLiteDataReader.Close方法代码示例

本文整理汇总了C#中System.Data.SQLite.SQLiteDataReader.Close方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteDataReader.Close方法的具体用法?C# SQLiteDataReader.Close怎么用?C# SQLiteDataReader.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.SQLite.SQLiteDataReader的用法示例。


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

示例1: ReadUserInfo

        public List<UserInfo> ReadUserInfo()
        {
            // Create a list for the user info.
            List<UserInfo> listUserInfo = new List<UserInfo>();

            // Open the database.
            dbConnection.Open();

            // Retrieve all records from the table called "mailaddresses".
            dbCommand.CommandText = "SELECT * FROM mailaddresses;";

            // Execute the newly created command.
            dbQuery = dbCommand.ExecuteReader();

            // Read the retrieved query, and write the results to the newly created list.
            while (dbQuery.Read())
                listUserInfo.Add(new UserInfo
                {
                    userMail = dbQuery["address"].ToString(),
                    password = dbQuery["password"].ToString(),
                    autoLogin = dbQuery["autologin"].ToString()
                });

            // Close the query-reader again.
            dbQuery.Close();

            // Close the database again.
            dbConnection.Close();

            // Return the created list.
            return listUserInfo;
        }
开发者ID:Woodje,项目名称:MailClient,代码行数:32,代码来源:LoginDatabase.cs

示例2: GetPreText

        public string GetPreText(UInt16 RcpId)
        {
            string ret = "";
            try
            {
                _SQLiteConnection.Open();
                string qury = string.Format("select * from tb_recipe where ID={0}", RcpId);
                SQLiteCommand command = new SQLiteCommand(qury, _SQLiteConnection);
                _reader = command.ExecuteReader();
                while (_reader.Read())
                    ret = _reader["ShowInfo"].ToString();
                Console.ReadLine();

            }
            catch (Exception e)
            {
                Console.WriteLine(e);

            }
            finally
            {
                _reader.Close();
                _SQLiteConnection.Close();

            }
            return ret;
        }
开发者ID:lee-icebow,项目名称:CREM.EVO,代码行数:27,代码来源:DataBaseHelp.cs

示例3: Report

        public Report()
        {
            InitializeComponent();

            // Connect to database file
            sql_con = new SQLiteConnection("Data Source=" + applicationPath + "\\ExpenseTracker.db;Version=3;New=False;Compress=True;");
            sql_cmd = new SQLiteCommand();
            sql_con.Open();
            sql_cmd.Connection = sql_con;
            sql_cmd.CommandText = "SELECT * FROM Month";
            sql_reader = sql_cmd.ExecuteReader();
            while (sql_reader.Read())
            {
                dataGridView.Rows.Add(
                    sql_reader.GetInt32(0),
                    CustomDate.GetThaiMonth(sql_reader.GetInt32(1)),
                    sql_reader.GetDecimal(2).ToString("#,#0.00#"),
                    sql_reader.GetDecimal(3).ToString("#,#0.00#"),
                    sql_reader.GetDecimal(4).ToString("#,#0.00#")
                );
            }
            sql_reader.Close();

            dataGridView.ClearSelection();
        }
开发者ID:TheProjecter,项目名称:expense-tracker-th,代码行数:25,代码来源:Report.cs

示例4: SendAlertForm

        public SendAlertForm()
        {
            InitializeComponent();

            // Open
            sqlite_conn.Open();

            // 要下任何命令先取得該連結的執行命令物件
            sqlite_cmd = sqlite_conn.CreateCommand();

            // 查詢Status表單,取告警代號、告警說明
            sqlite_cmd.CommandText = "SELECT * FROM Status";

            // 執行查詢Status塞入 sqlite_datareader
            sqlite_datareader = sqlite_cmd.ExecuteReader();

            RDSStsDescList = new List<string>();

            // 一筆一筆列出查詢的資料
            while (sqlite_datareader.Read())
            {
                // Print out the content of the RDSStsID field:
                RDSStsID = sqlite_datareader["RDSStsID"].ToString();
                RDSStsDesc = sqlite_datareader["RDSStsDesc"].ToString();
                cboWarn.Items.Add(RDSStsID);
                RDSStsDescList.Add(RDSStsDesc);

                //MessageBox.Show(s);
            }
            sqlite_datareader.Close();
            cboWarn.SelectedIndex = 0;
            //結束,關閉資料庫連線
            sqlite_conn.Close();
        }
开发者ID:starboxs,项目名称:GPS_Service,代码行数:34,代码来源:SendAlertForm.cs

示例5: GetAllBooks

        public List<Tuple<string, string, string, string, string>> GetAllBooks()
        {
            var books = new List<Tuple<string, string, string, string, string>>();

            m_dbConnection = new SQLiteConnection("Data Source=" + db + ";Version=3;");
            m_dbConnection.Open();

            string sql = "SELECT * FROM books";

            command = new SQLiteCommand(sql, m_dbConnection);
            reader = command.ExecuteReader();

            string id = "";
            string title = "";
            string auteur = "";
            string picture = "";
            string synopsis = "";
            while (reader.Read())
            {
                id = reader["id"].ToString();
                title = reader["title"].ToString();
                auteur = reader["auteur"].ToString();
                picture = reader["picture"].ToString();
                synopsis = reader["synopsis"].ToString();
                books.Add(new Tuple<string, string, string, string, string>(id, title, auteur, picture, synopsis));
            }

            reader.Close();
            m_dbConnection.Close();

            return books;
        }
开发者ID:tbarrot,项目名称:library_project,代码行数:32,代码来源:Books.cs

示例6: ReadMail

        public Message ReadMail(string userMail, int rowNumber)
        {
            // Declare a variable for the converted results.
            Message result;

            // Open the database.
            dbConnection.Open();

            // Retrieve all records from the table called "mails" for the specified usermail.
            dbCommand.CommandText = "SELECT * FROM mails WHERE address='" + userMail + "';";

            // Execute the newly created command.
            dbQuery = dbCommand.ExecuteReader();

            // Read the retrieved query, and convert the result to bytes from the current string.
            while (dbQuery.Read())
            {
                // Check if the current row is the one specified.
                if (dbQuery.StepCount == rowNumber)
                {
                    // Convert the result to bytes and then to a message and put this into the message variable.
                    result = new Message(Convert.FromBase64String(dbQuery["rawmessage"].ToString()));

                    // Close the query-reader again.
                    dbQuery.Close();

                    // Close the database again.
                    dbConnection.Close();

                    // Break out of the loop by returning the converted mathing result.
                    return result;
                }
            }

            // Close the query-reader again.
            dbQuery.Close();

            // Close the database again.
            dbConnection.Close();

            // Return a null if nothing is found.
            return null;
        }
开发者ID:Woodje,项目名称:MailClient,代码行数:43,代码来源:MailDatabase.cs

示例7: ReturnTotals

		public float ReturnTotals(string command)
		{
            mycommand = new SQLiteCommand(connector);		
			mycommand.CommandText = command;
		    reader = mycommand.ExecuteReader();
            reader.Read();
            float tempValue = 0.0f;
            if (!DBNull.Value.Equals(reader[0]))
            {
	            tempValue = System.Convert.ToSingle(reader[0]);        	
            }
            reader.Close();
            
            return tempValue;

		}
开发者ID:atomoson,项目名称:Checkbook,代码行数:16,代码来源:db.cs

示例8: CreateChart

        public void CreateChart(ZedGraphControl zgc)
        {
            GraphPane myPane = zgc.GraphPane;

            PointPairList lstIncome = new PointPairList();
            PointPairList lstExpense = new PointPairList();

            // Set the title and axis labels
            myPane.Title.FontSpec.Family = "Browallia New";
            myPane.Title.FontSpec.Size = 24;
            myPane.Title.Text = "สรุป";
            myPane.XAxis.Title.FontSpec.Family = "Browallia New";
            myPane.XAxis.Title.FontSpec.Size = 16;
            myPane.XAxis.Title.Text = "เดือน";
            myPane.XAxis.Type = AxisType.Text;
            myPane.YAxis.Title.FontSpec.Family = "Browallia New";
            myPane.YAxis.Title.FontSpec.Size = 24;
            myPane.YAxis.Title.Text = "จำนวนเงิน";

            // Load data for this month
            sql_cmd.CommandText = "SELECT Month, TotalIncome, TotalExpense FROM Month WHERE Year = '" + CustomDate.GetThaiYear(DateTime.Today.Year) + "'";
            sql_reader = sql_cmd.ExecuteReader();
            while (sql_reader.Read())
            {
                monthsLabel.Add(CustomDate.GetThaiMonth(sql_reader.GetInt32(0)));
                lstIncome.Add(0, sql_reader.GetDouble(1));
                lstExpense.Add(0, sql_reader.GetDouble(2));
            }
            sql_reader.Close();

            myPane.XAxis.Scale.FontSpec.Family = "Browallia New";
            myPane.XAxis.Scale.FontSpec.Size = 16;
            myPane.XAxis.Scale.TextLabels = monthsLabel.ToArray();

            BarItem myCurve = myPane.AddBar("รายรับ", lstIncome, Color.Blue);
            BarItem myCurve2 = myPane.AddBar("รายจ่าย", lstExpense, Color.Red);

            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, 255, 166), 45.0F);

            myPane.YAxis.Scale.Max += myPane.YAxis.Scale.MajorStep;

            //BarItem.CreateBarLabels(myPane, false, "#,#0.00#", "Tahoma", 10, Color.Black, true, false, false);

            zgc.AxisChange();
        }
开发者ID:TheProjecter,项目名称:expense-tracker-th,代码行数:45,代码来源:Graph.cs

示例9: AlertLog

 public AlertLog()
 {
     InitializeComponent();
     sqlite_conn.Open();
     sqlite_cmd = sqlite_conn.CreateCommand();
     sqlite_cmd.CommandText = "SELECT * FROM ALERTLOG;";
     sqlite_datareader = sqlite_cmd.ExecuteReader();
     while (sqlite_datareader.Read())
     {
         var MsgNum = sqlite_datareader["msgid"].ToString();
         var RdsNum = sqlite_datareader["rdsid"].ToString();
         var SendTime = sqlite_datareader["alerttime"].ToString();
         var ClientId = sqlite_datareader["clientid"].ToString();
         var CheckTime = sqlite_datareader["checktime"].ToString();
         txtLog.AppendText(string.Format("第{0}號訊息_訊息代碼:{1}_發送時間:{2}_手機ID:{3}_確認時間:{4}\r\n", MsgNum, RdsNum, SendTime, ClientId, CheckTime));
     }
     sqlite_datareader.Close();
     sqlite_conn.Close();
 }
开发者ID:starboxs,项目名称:GPS_Service,代码行数:19,代码来源:AlertLog.cs

示例10: Form6_Load

        private void Form6_Load(object sender, EventArgs e)
        {
            comboBox1.Text = "";
            var m_dbConnection = new SQLiteConnection("Data Source=28cm_db.sqlite;Version=3;");
            int N = 0;
            
            sql = "SELECT COUNT(rowid) FROM Groups";
            command = new SQLiteCommand(sql, m_dbConnection);
            
            m_dbConnection.Open();
            reader = command.ExecuteReader();
            if (reader.Read())
                N = Convert.ToInt32(reader["COUNT(rowid)"]);
            reader.Close();
            m_dbConnection.Close();


            for (int i = 1; i <= N; i++)
            {
                sql = "SELECT name FROM Groups WHERE rowid = ('" + i + "')";
                command = new SQLiteCommand(sql, m_dbConnection);

                m_dbConnection.Open();
                reader = command.ExecuteReader();


                if (reader.Read())
                {

                    group_name = Convert.ToString(reader["name"]);

                }

                reader.Close();
                m_dbConnection.Close();

                comboBox1.Items.Add(group_name);
            }
        }
开发者ID:VladimiMikhailov,项目名称:28cm,代码行数:39,代码来源:Form6.cs

示例11: ReadUserSettings

        public List<UserSettings> ReadUserSettings()
        {
            // Create a list for the user settings.
            List<UserSettings> listUserSettings = new List<UserSettings>();

            // Open the database.
            dbConnection.Open();

            // Retrieve all records from the table called "mailaddresses".
            dbCommand.CommandText = "SELECT * FROM mailaddresses;";

            // Execute the newly created command.
            dbQuery = dbCommand.ExecuteReader();

            // Read the retrieved query, and write the results to the newly created list.
            while (dbQuery.Read())
                listUserSettings.Add(new UserSettings
                {
                    userMail = dbQuery["address"].ToString(),
                    password = dbQuery["password"].ToString(),
                    receiveServer = dbQuery["receiveserver"].ToString(),
                    receivePort = (int)dbQuery["receiveport"],
                    receiveSSL = dbQuery["receivessl"].ToString(),
                    sendServer = dbQuery["sendserver"].ToString(),
                    sendPort = (int)dbQuery["sendport"],
                    sendSSL = dbQuery["sendssl"].ToString(),
                });

            // Close the query-reader again.
            dbQuery.Close();

            // Close the database again.
            dbConnection.Close();

            // Return the created list.
            return listUserSettings;
        }
开发者ID:Woodje,项目名称:MailClient,代码行数:37,代码来源:SettingsDatabase.cs

示例12: getMoiveCount

        private void getMoiveCount()
        {
            try
            {
                cmd.CommandText = "select count(*) from movies where status='0';";
                reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    txttotalmovies.Text = "total movies : " + reader[0].ToString();
                    if (Convert.ToInt32(reader[0]) > 0)
                    {
                        deatilpane.Visibility = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        deatilpane.Visibility = System.Windows.Visibility.Hidden;
                    }

                }
                reader.Close();
            }
            catch (Exception)
            {}
        }
开发者ID:sijojose210,项目名称:movie-manager-.net,代码行数:24,代码来源:Waiting.xaml.cs

示例13: fillMovieList

        private void fillMovieList()
        {
            try
            {
                itemupdating = true;
                movielist.Items.Clear();
                cmd.CommandText = "SELECT title FROM movies  order by movieID desc";
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    movielist.Items.Add(reader["Title"]);
                }
                reader.Close();
                itemupdating = false;
                movielist.SelectedIndex = -1;
                if (movielist.Items.Count >= 0)
                {
                    movielist.SelectedIndex = 0;
                }
            }
            catch (Exception)
            {}

        }// file the movie list with all movies
开发者ID:sijojose210,项目名称:movie-manager-.net,代码行数:24,代码来源:All.xaml.cs

示例14: run_query

 public DataTable run_query(string sql_query)
 {
     DataTable sql_result = new DataTable();
     try
     {
         using (connection = new SQLiteConnection(database_connection_string))
         {
             connection.Open();
             command = new SQLiteCommand(connection);
             command.CommandText = sql_query;
             data_reader = command.ExecuteReader();
             sql_result.Load(data_reader);
             data_reader.Close();
             connection.Close();
         }
     }
     catch (Exception e)
     {
         close_connections();
         throw e;
     }
     return sql_result;
 }
开发者ID:haohaolin1988,项目名称:sqlite_core,代码行数:23,代码来源:SQLiteCore.cs

示例15: movielist_SelectionChanged

        private void movielist_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (movielist.SelectedIndex >= 0 && movielist.Items.Count > 0 && itemupdating == false)
                {
                    string listitem = movielist.SelectedItem.ToString();
                    cmd.CommandText = "SELECT * FROM movies where title='" + listitem + "';";
                    reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        txtnameyr.Text = reader[1].ToString() + " " + "(" + reader[2].ToString() + ")";
                        txtreleased.Text = reader[4].ToString();
                        txtrating.Text = reader[16].ToString();
                        txtruntime.Text = reader[5].ToString();
                        txtgenre.Text = reader[6].ToString();
                        txtdirector.Text = reader[7].ToString();
                        txtwriter.Text = reader[8].ToString();
                        txtactor.Text = reader[9].ToString();
                        txtlanguage.Text = reader[11].ToString();
                        txtmetascore.Text = reader[15].ToString();
                        txtimdbvoters.Text = reader[17].ToString();
                        txtcountry.Text = reader[12].ToString();
                        txttype.Text = reader[19].ToString();
                        txtawards.Text = reader[13].ToString();
                        txtplot.Text = reader[10].ToString();

                        movieId = reader[0].ToString();
                        imdbID = reader[18].ToString();

                        status = Convert.ToBoolean(Convert.ToInt16(reader[20].ToString()));
                        like = Convert.ToBoolean(Convert.ToInt16(reader[21].ToString()));
                    }

                    if (File.Exists(util.getImagePath() + reader[18]))
                    {
                        posterimage.Source = img(util.getImagePath()+ reader[18]);
                    }
                    else
                    {
                        posterimage.Source = img(util.getblankPoster());
                    }
                    setStatus();
                    setLike();
                    reader.Close();
                }
            }
            catch (Exception)
            {}
        }
开发者ID:sijojose210,项目名称:movie-manager-.net,代码行数:50,代码来源:Waiting.xaml.cs


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