本文整理汇总了C#中SqlCeCommand.Close方法的典型用法代码示例。如果您正苦于以下问题:C# SqlCeCommand.Close方法的具体用法?C# SqlCeCommand.Close怎么用?C# SqlCeCommand.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlCeCommand
的用法示例。
在下文中一共展示了SqlCeCommand.Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnCreateIndex_Click
private void btnCreateIndex_Click(object sender, EventArgs e)
{
SQLIndexCreator creator = new SQLIndexCreator();
string sql = "SELECT VerseID, VerseText FROM Verse";
using (SqlCeConnection conn = new SqlCeConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
conn.Open();
SqlCeDataReader rdr = new SqlCeCommand(sql, conn).ExecuteReader();
creator.CreateIndex("Bible", IndexDir, rdr, new CultureInfo("en-US"), "VerseID", "VerseText");
rdr.Close();
}
}
示例2: lbResults_DoubleClick
private void lbResults_DoubleClick(object sender, EventArgs e)
{
// Show the bible verse
if (lbResults.SelectedIndex >= 0)
{
string value = lbResults.SelectedItem.ToString();
int keyIndex = value.IndexOf("Key: ") + 4;
string key = value.Substring(keyIndex, value.IndexOf('\t', keyIndex) - keyIndex).Trim(';').Trim();
int verseId = int.Parse(key);
// Get the verse
string sql = "SELECT v.*, b.* FROM Verse v INNER JOIN Book b ON v.BookID = b.BookID WHERE VerseID = " + verseId;
string verse = string.Empty;
using (SqlCeConnection conn = new SqlCeConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
conn.Open();
SqlCeDataReader rdr = new SqlCeCommand(sql, conn).ExecuteReader();
rdr.Read();
verse = string.Format("{0} {1}:{2} - {3}", rdr["BookName"], rdr["BookNum"], rdr["VerseNum"], rdr["VerseText"]);
rdr.Close();
}
MessageBox.Show(verse);
}
}