When I click search button error occurs conversion dbnull to type string is not valid.
I think there's no data in some cells in my database.
its not a problem to have empty cells and if there are empty cells I don't want to load them to my form.
Here's what I tried ButtonClickEvent :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Dimuth De Zoysa\Documents\divimaga_DB.accdb")
cmd = New OleDbCommand("SELECT * FROM MainE WHERE Job ='" + ComboBox1.Text + "' ", con)
con.Open()
dr = cmd.ExecuteReader()
While dr.Read
jobid = dr("JobID")
TextBox1.Text = dr("PROCEDURE")
TextBox2.Text = dr("ReleventDocuments")
TextBox3.Text = dr("ImportantPoints")
TextBox4.Text = dr("officer")
End While
con.Close()
End Sub