2
Answers

Data type mismatch in criteria expression

karthi keyan

karthi keyan

13y
8.5k
1
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)