0
即時嘗試做一個程序,您可以從我的sqlite數據庫中選擇一個ID,並通過改變一個列我的問題是使C#理解我的readline應該是我的ID數據庫從sqlite挑選一個ID到C#控制檯
IM做一個字符串值(名爲行)那是我的ReadLine,但我怎麼能告訴C#是隻是應該的WriteLine的ID =行
sql_con = new SQLiteConnection(@"Data Source=C:\Users\Jebus\test\ConsoleApplication1\ConsoleApplication1\bin\Debug\RytterDatabase;Version=3;New=False;Compress=True;");
sql_con.Open();
string row;
row = Console.ReadLine();
SQLiteCommand buycommand = new SQLiteCommand ("SELECT ID,Name FROM rytter");
buycommand.Connection = sql_con;
buycommand.Prepare();
buycommand.Parameters.AddWithValue("ID",Int32.Parse(row));
SQLiteDataReader rdr = buycommand.ExecuteReader();
if (rdr.HasRows)
{
while (rdr.Read())
{
Console.WriteLine("{0}\t{1}",rdr.GetInt32(0),rdr.GetString(1));
}
}