25-07-15, 12:46 PM
سلام
موفقين
كود :
Private Sub cBoxCustName_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles cBoxCustName.SelectionChangeCommitted
Try
Using conn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=False;")
Using dAdapter As New OleDb.OleDbDataAdapter("SELECT * FROM [Customers] WHERE [Cust_Name] = @Cust_Name ", conn)
dAdapter.SelectCommand.Parameters.AddWithValue("@Cust_Name", cBoxCustName.Text)
Using dTable As New DataTable
If dAdapter.Fill(dTable) > 0 Then
Dim row As DataRow = dTable.Rows(0)
txtCust_ID.Text = row("Cust_ID")
txtCustCPR.Text = row("Cust_CPR")
txtCustContactNo.Text = row("Cust_Contact_No")
txtFlatNo.Text = row("Cust_Address")
End If
End Using
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error 123", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Subموفقين
متغيب
