Hi,

This is my situation. I am entering a value in textbox and click the find button. In the button click i've written the following code, but it does not yield any result. Kindly help.

dbprovider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbsource = "Data Source = D:\sprrg.mdb"
        con.ConnectionString = dbprovider & dbsource
        con.Open()
        sql = "select * from job_master where job_code = ' & txtjob.text & '"
        da = New OleDb.OleDbDataAdapter(sql, con)

        da.Fill(ds, "sprrg")
        maxrows = ds.Tables("sprrg").Rows.Count
        inc = 0
        MsgBox(maxrows)
        txtJob.Text = ds.Tables("sprrg").Rows(0).Item("job_code").ToString
        txtDate.Text = ds.Tables("sprrg").Rows(0).Item("job_name").ToString
        'txtItem.Text = ds.Tables("sprrg").Rows(0).Item("item_code")
        'txtMrnno.Text = ds.Tables("sprrg").Rows(0).Item("mr_no")
        con.Close()

Recommended Answers

All 2 Replies

You are missing a doublequote here:

job_code = ' & txtjob.text

it should be

job_code = '" & txtjob.text

You are missing a doublequote here:

job_code = ' & txtjob.text

it should be

job_code = '" & txtjob.text

Thanks a lot ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.