[英]system.data.oledb.oledbexception data type mismatch in criteria expression
[英]System.Data.OleDb.OleDbException: Data type mismatch in criteria expression
這是我的代碼:
OleDbCommand Cmd = new OleDbCommand();
Cmd.Connection = MyConn;
Cmd.CommandText = "SELECT * FROM catalogue WHERE id = '" + questionid + "'";
OleDbDataReader read = Cmd.ExecuteReader();
int id = 0;
while (read.Read())
{
id = Convert.ToInt32(read["id"]);
}
這是它給我的錯誤:
Line 27: Cmd.CommandText = "SELECT * FROM catalogue WHERE id = '" + questionid + "'";
Line 28:
Line 29: OleDbDataReader read = Cmd.ExecuteReader(); // The error is here
Line 30:
Line 31: int id = 0;
我知道在Stack Overflow上還有另一個關於同一問題的問題 ,但它似乎沒有解決我的問題(它可以解決你的問題,所以我放了一個鏈接)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.