VINAY KUMAR

VINAY KUMAR

  • 1.6k
  • 92
  • 63.2k

: Data type mismatch in criteria expression

Feb 25 2017 10:11 AM
 when iam select id in dropownlist iwant to display stuentname in textbox...
 
when iam use below code it shos error like.....
System.Data.OleDb.OleDbException: Data type mismatch in criteria expression. 
 
 
string value2 = ddcoursej.SelectedItem.Text;
string value1 = txtseach.Text;
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\TecbuzzDb\\techdb.accdb");
con.Open();
OleDbCommand cmd = new OleDbCommand("select ID ,Student_name, Mobile from stuentregistration WHERE ID='" + value2 + "'", con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
// DataSet ds = new DataSet();
DataTable DT = new DataTable();
da.Fill(DT);
txtname10.Text= DT.Rows[0]["Student_name"].ToString();
 
 
 

Answers (1)