25-07-15, 01:14 PM
(آخر تعديل لهذه المشاركة : 25-07-15, 01:21 PM {2} بواسطة 0theghost0.)
مشكور اخوي لكن للاسف الكود ليس به خطأ لكن لم تظهر لي اي معلومات
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 [Rent_Equipment] WHERE [Cus_ID] = @Cus_ID ", conn)
dAdapter.SelectCommand.Parameters.AddWithValue("@Cus_ID", ComboBox1.Text)
Using dTable As New DataTable
If dAdapter.Fill(dTable) > 0 Then
Dim row As DataRow = dTable.Rows(0)
ComboBox1.Text = row("Cus_ID")
TextBox1.Text = row("Cus_Name")
TextBox2.Text = row("Cus_Private_Number")
End If
End Using
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error 123", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
اخوي هذا كود توي شايفنه بس فيه مشكلة
الكود
Using conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=False;")
conn.Open()
Dim sql As String =
"select * from Rent_Equipment where Cus_ID='" & ComboBox1.Text & "'"
mySQLCommand.CommandText = mySQLStrg
mySQLCommand.Connection = myConnToAccess
dr = mySQLCommand.ExecuteReader
If (dr.Read() = True) Then
TextBox1.Text = (dr("Cus_Name"))
End If
mySQLCommand.Dispose()
dr.Close()
End Using
مكان الخطأ
mySQLCommand.CommandText = mySQLStrg
عنوان الخطأ
An unhandled exception of type 'System.NullReferenceException' occurred in 1111.exe
Additional information: Object reference not set to an instance of an object.
هذا التعريفات
Imports System.Data.OleDb
Imports AccessToAccess
Public Class Form4
Public myConnToAccess As OleDbConnection
Dim mySQLCommand As OleDbCommand
Dim mySQLStrg As String
Dim ds As DataSet
Dim da As OleDbDataAdapter
Dim dr As OleDbDataReader
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 [Rent_Equipment] WHERE [Cus_ID] = @Cus_ID ", conn)
dAdapter.SelectCommand.Parameters.AddWithValue("@Cus_ID", ComboBox1.Text)
Using dTable As New DataTable
If dAdapter.Fill(dTable) > 0 Then
Dim row As DataRow = dTable.Rows(0)
ComboBox1.Text = row("Cus_ID")
TextBox1.Text = row("Cus_Name")
TextBox2.Text = row("Cus_Private_Number")
End If
End Using
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error 123", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
اخوي هذا كود توي شايفنه بس فيه مشكلة
الكود
Using conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=False;")
conn.Open()
Dim sql As String =
"select * from Rent_Equipment where Cus_ID='" & ComboBox1.Text & "'"
mySQLCommand.CommandText = mySQLStrg
mySQLCommand.Connection = myConnToAccess
dr = mySQLCommand.ExecuteReader
If (dr.Read() = True) Then
TextBox1.Text = (dr("Cus_Name"))
End If
mySQLCommand.Dispose()
dr.Close()
End Using
مكان الخطأ
mySQLCommand.CommandText = mySQLStrg
عنوان الخطأ
An unhandled exception of type 'System.NullReferenceException' occurred in 1111.exe
Additional information: Object reference not set to an instance of an object.
هذا التعريفات
Imports System.Data.OleDb
Imports AccessToAccess
Public Class Form4
Public myConnToAccess As OleDbConnection
Dim mySQLCommand As OleDbCommand
Dim mySQLStrg As String
Dim ds As DataSet
Dim da As OleDbDataAdapter
Dim dr As OleDbDataReader

