我想从sqlite数据库中获取日期。表列名为"日期",列类型为日期。
SQLiteCommand sqlite_cmd;
SQLiteDataReader sqlite_datareader;
sqlite_conn = new SQLiteConnection(sConnectionString);
sqlite_conn.Open();
sqlite_cmd = sqlite_conn.CreateCommand();
sqlite_cmd.CommandText = "Select * from prework where pid = " + iProjectID + " and chainage = " + fChainage + ";";
try
{
sqlite_datareader = sqlite_cmd.ExecuteReader();
while (sqlite_datareader.Read())
{
String str = sqlite_datareader["date"].ToString();
}
}
catch
{
return;
}
我想在str
变量中获取日期。
将查询更改为此
"Select * from prework where pid = '" + iProjectID + "' and chainage = '" + fChainage + "';