karthi keyan

karthi keyan

  • NA
  • 1
  • 10.3k

Data type mismatch in criteria expression

Dec 11 2010 12:20 PM
I am developing a vb.net application with MS Access Database . 
I have a field(cut) with double data type in table marks of markss.mdb .

Following is my code:
        Dim cob As Double
        cob = CDbl(TextBox1.Text)'to convert textbox value to double
        dbprovider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbsource = "Data Source=F:\vb\markss.mdb"
        con.ConnectionString = dbprovider & dbsource
        con.Open()
        sql = "select name from marks where cut = 'cob'"
        da = New OleDb.OleDbDataAdapter(sql, con)      
        da.Fill(ds, "result")
On debugging , when I enter ,say 7.9 , in Textbox 1 ,I get an error saying Data type mismatch in criteria expression.
Please help me to resolve this issue , guys ..
Thanks in advance !!!

Answers (2)