25-07-15, 02:58 PM
الحمدالله رب العالمين شغال 100%
لكن اذا قلنا نريد ان نختار على حسب الاسم لماذا لايعمل رغم اني غيرت المطلوب
الكود
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 [Equipment] WHERE [Equ_Name] = @Equ_Name ", conn)
dAdapter.SelectCommand.Parameters.AddWithValue("@Equ_Name", Val(ComboBox2.Text))
Using dTable As New DataTable
If dAdapter.Fill(dTable) > 0 Then
Dim row As DataRow = dTable.Rows(0)
TextBox4.Text = row("Equ_ID")
End If
End Using
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Read Equpment", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
لكن اذا قلنا نريد ان نختار على حسب الاسم لماذا لايعمل رغم اني غيرت المطلوب
الكود
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 [Equipment] WHERE [Equ_Name] = @Equ_Name ", conn)
dAdapter.SelectCommand.Parameters.AddWithValue("@Equ_Name", Val(ComboBox2.Text))
Using dTable As New DataTable
If dAdapter.Fill(dTable) > 0 Then
Dim row As DataRow = dTable.Rows(0)
TextBox4.Text = row("Equ_ID")
End If
End Using
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error Read Equpment", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

