Hello again guys,
I am little bit stuck in this situation and searched everywhere in google
but i did'nt find what actually i want..
a problem with autonumber in access database. i have created a database with 4 columns .. deleted primary key slip, cname, nic... the slip column is autonumber (not primary key).
heres my code and the error..
i want that when i enter slip number in textbox it searchs the slip no in the database
of slip column.. but i dont know whats the problem here.
and please tell me what is difference between oledbdatadapter and olebdcommand and oldbcommandreader.
ERROR:
{"Data type mismatch in criteria expression."}
Code:
long cno = Convert.ToInt64(textBox3.text);
OleDbConnection connect = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; data source = customers.mdb");
OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from Customer where Slip='" + cno + "'", this.connect);
OleDbCommand read= new OleDbCommand("Select * from Customer where Slip='" + cno + "'", this.connect);
this.connect.Open();
object existentry = read.ExecuteScalar();
if (existentry == null)
{
MessageBox.Show("Slip number not found.");
return;
}
else
{
// blah blah code,
}
this.Close();