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.

{"Data type mismatch in criteria expression."}


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);

  object existentry = read.ExecuteScalar();
  if (existentry == null)
        MessageBox.Show("Slip number not found.");
        // blah blah code,

Edited 5 Years Ago by shayankhan: n/a

ohhhhhh i am so sorry for this thread
i got what was the error .. please close this thread
well the error was
'" + cno + "'"
' ' means character while my autonumber contains integer
sorry. and thanks

This question has already been answered. Start a new discussion instead.