Hi,
i had some error when retrieving data from database when the symbol is inside a name. as in picture
my code are as below :
i had some error when retrieving data from database when the symbol is inside a name. as in picture
my code are as below :
Private Sub enamecombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles enamecombo.SelectedIndexChanged Try con2.ResetState() con2.Dispose() eictextbox.Clear() ds2.Clear() ds2.Dispose() dbProvider2 = "PROVIDER=Microsoft.ACE.OLEDB.12.0;" dbSource2 = "Data Source = C:\Users\Paul\Desktop\SkyPOS\SkyPOS\empdb.accdb" con2.ConnectionString = dbProvider2 & dbSource2 con2.Open() sql2 = "Select * from tblemp where ename = '" & enamecombo.Text & "' " da2 = New OleDb.OleDbDataAdapter(sql2, con2) da2.Fill(ds2, "tblemp") Dim command2 As New System.Data.OleDb.OleDbCommand(sql2, con2) Dim reader2 As System.Data.OleDb.OleDbDataReader = command2.ExecuteReader() While reader2.Read() ' eictextbox.Text = reader2.Item("eic").ToString() eictextbox.Text = ds2.Tables("tblemp").Rows(0).Item("eic").ToString() End While con2.Close() con2.Dispose() ds2.Dispose() da2.Dispose() reader2.Close() con2.Close() Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub
Last edited by a moderator: