When I try(string search = textBox1.Text.ToString();) to search a row from access database it says to me "Mismatched datatype ON access the type is ShortText?
Loading
When I try(string search = textBox1.Text.ToString();) to search a row from access database it says to me "Mismatched datatype ON access the type is ShortText?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Oct 19, 2021, 4:18 AM
NURU DAWUDPosted Oct 18, 2021, 6:30 PM
System.Data.OleDb.OleDbException: 'Data type mismatch in criteria expression.'
code sample
public void search()
{
string search = Convert.ToString(txtSearch.Text);
con = new ConnectionClass();
con.oledbquery("select * from tableuser where primarykey = " +search+" ") ;
con.d2 = con.cmd.ExecuteReader();
// con.queryex();
while (con.d2.Read())
{
weredaId_47.Text = con.d2[0].ToString();
regBookNo_1.Text = con.d2.GetString(1);
birthRegBookNo_2.Text = con.d2.GetString(2);
regOfficeNo_3.Text = con.d2.GetString(3);
birthRegIdNo_4.Text = con.d2.G
}
}
Srinivasan RamamoorthiPosted Oct 18, 2021, 11:52 AM
Try to get the select query from C# watch window and run it against ACCESS database to check the issue.
Rijwan AnsariPosted Oct 18, 2021, 11:40 AM
Sachin SinghPosted Oct 18, 2021, 5:36 AM