السلام عليكم
الكود التالي يقوم بالبحث واظهار النتائج على صناديق النصوص في الفورم
وارغب بالاضافة الى ذلك ان يقوم زري التحكم (التالي) و (السابق) باظهار باقي نتائج البحث فقط
وقمت بعمل binding الا انه يظهر لي رسالة خطاء واليكم الكود
If RadioButton1.Checked = True Then
If nametext.Text = "" Then
MsgBox("خطاء في البحث !! الرجاء ادخال اسم الموظف")
Call cancel()
Call clear()
Else
SqlCommand4.Parameters("@tech_name").Value = nametext.Text
Dim read As SqlClient.SqlDataReader
SqlConnection1.Open()
read = SqlCommand4.ExecuteReader
If Not read.Read Then
MsgBox("الاسم غير موجود")
read.Close()
SqlConnection1.Close()
Call cancel()
Call clear()
Else
TextBox1.Text = read.Item("id")
nametext.Text = read.Item("tech_name")
ComboBox1.Text = read.Item("tech_sec")
ComboBox2.Text = read.Item("tech_level")
usertext.Text = read.Item("tech_user_name")
passtext.Text = read.Item("tech_password")
pass1text.Text = read.Item("tech_rpassword")
ComboBox3.Text = read.Item("user_type")
read.Close()
da = New SqlDataAdapter("select * from client where (tech_name LIKE @tech_name + N'%')", SqlConnection1)
da.FillSchema(ds, SchemaType.Source, "cilent")
da.Fill(ds, "client")
SqlConnection1.Close()
bind.DataSource = ds
bind.DataMember = "client"
SqlConnection1.Close()
Me.TextBox1.DataBindings.Add(New Binding("text", bind, "id", True))
Me.nametext.DataBindings.Add(New Binding("text", bind, "tech_name", True))
Me.ComboBox1.DataBindings.Add(New Binding("text", bind, "tech_sec", True))
Me.ComboBox2.DataBindings.Add(New Binding("text", bind, "tech_level", True))
Me.usertext.DataBindings.Add(New Binding("text", bind, "tech_user_name", True))
Me.passtext.DataBindings.Add(New Binding("text", bind, "tech_password", True))
Me.pass1text.DataBindings.Add(New Binding("text", bind, "tech_rpassword", True))
Me.ComboBox3.DataBindings.Add(New Binding("text", bind, "user_type", True))
End If
End If
End Ifورسالة الخطاء هي كالتالي
Must declare the variable '@tech_name'
وكود زري السابق والتالي
bind.MoveNext()
bind.MovePrevious()
علماً بان البرنامج ينفذ الربط او binding بشكل صحيح ولكن لكل البيانات بالجدول
كود binding الجدول
Dim ds As New DataSet
Dim da As New SqlDataAdapter
Dim bind As New BindingSource
Private Sub Users_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SqlConnection1.Open()
da = New SqlDataAdapter("select * from client", SqlConnection1)
da.FillSchema(ds, SchemaType.Source, "cilent")
da.Fill(ds, "client")
SqlConnection1.Close()
bind.DataSource = ds
bind.DataMember = "client"
Me.TextBox1.DataBindings.Add(New Binding("text", bind, "id", True))
Me.nametext.DataBindings.Add(New Binding("text", bind, "tech_name", True))
Me.ComboBox1.DataBindings.Add(New Binding("text", bind, "tech_sec", True))
Me.ComboBox2.DataBindings.Add(New Binding("text", bind, "tech_level", True))
Me.usertext.DataBindings.Add(New Binding("text", bind, "tech_user_name", True))
Me.passtext.DataBindings.Add(New Binding("text", bind, "tech_password", True))
Me.pass1text.DataBindings.Add(New Binding("text", bind, "tech_rpassword", True))
Me.ComboBox3.DataBindings.Add(New Binding("text", bind, "user_type", True))
Label13.Text = username
End Subفاين سبب وجود هذا الخطاء
شكراً