بعد السلام ، اجمل التحايا لأعضاء منتدى الفريق العربي للبرمجة ,,,,
اول مشاركة لي وان شاء الله القادم افضل،،،
الكود:
Me.OleDbConnection1.Close()
Me.OleDbConnection1.Open()
Dim search As OleDb.OleDbDataReader
Me.OleDbDataAdapter1.SelectCommand.CommandText = "select * from Customers where [Name]=" + Me.TextBox1.Text + ""
search = Me.OleDbDataAdapter1.SelectCommand.ExecuteReader
search.Read()
If search.HasRows Then
Me.TextBox2.Text = search(0)
Me.TextBox4.Text = search(1)
Me.TextBox5.Text = search(2)
Me.TextBox6.Text = search(3)
Else
MsgBox("Check Name of Customer please!")
End If
Me.OleDbConnection1.Close()تظهر لي هذه المشكلة:
System.InvalidOperationException was unhandled
Message="ExecuteReader: Connection property has not been initialized."
Source="System.Data"
StackTrace:
at System.Data.OleDb.OleDbCommand.ValidateConnection(String method)
at System.Data.OleDb.OleDbCommand.ValidateConnectionAndTransaction(String method)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at Trial.AutoCumplete.Button1_Click(Object sender, EventArgs e) in D:\Trial\Trial\Trial\Form1.vb:line 9
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNat
veMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicat
onModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String
] commandLine)
at Trial.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
في السطر:
search = Me.OleDbDataAdapter1.SelectCommand.ExecuteReader
انا لا اريد عمل بحث ...
فقط اريد ان اكمل البيانات تبعا لأسم العميل في التكست بكس الاول مثلا Malk من الداتا بيز ليتم اكمال باقي البيانات بسرعة
مثل الهاتف والايميل والعنوان.
كنت اعمل بنفس الخاصية على VB2003 فلا اعلم الان هل المشكلة في النسخة 2007 حيث انني استخدمتها في هذا المثال
ام ان المشكلة في قاعدة بيانات الاكسس؟
المثال في المرفقات
دمتم بود وسلام