我想从 SQLite 数据库中读取日期时间值并将其分配给日期选择器控件。
这是我的代码:
try
{
sqlitecon.Open();
string Query = "Select * from Customer_New where Cust_Id='" + val + "' ";
SQLiteCommand createCommand = new SQLiteCommand(Query, sqlitecon);
// createCommand.ExecuteNonQuery();
SQLiteDataReader dr = createCommand.ExecuteReader();
while(dr.Read()){
date_open.DisplayDate = Convert.ToDateTime(dr.GetString(0));
Date_Joining.DisplayDate = Convert.ToDateTime(dr.GetString(1));
txt_Title.Text = dr.GetString(3);
txt_cardnum.Text =dr.GetString(4)
}
sqlitecon.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
但它给出了这个错误:“指定的演员表无效”。怎么做到呢?。