10-11-15, 07:48 PM
(آخر تعديل لهذه المشاركة : 10-11-15, 07:50 PM {2} بواسطة Mr. DotNet.)
تفضل عزيزي
ضع الكود في حدث الـ SelectedIndexChanged للـ ComboBox
PHP كود :
Dim Con As New SqlConnection("Your Connection String")
If Con.State = ConnectionState.Closed Then Con.Open()
Dim SqlStr As String = "Select * from TableName Where ID=" & ComboBox1.SelectedValue
Dim Cmd As New SqlCommand(SqlStr, Con)
Dim DR As SqlDataReader
DR = Cmd.ExecuteReader
If DR.HasRows Then
While DR.Read
TextBox1.Text = DR("FieldName")
TextBox2.Text = DR("FieldName")
TextBox3.Text = DR("FieldName")
TextBox4.Text = DR("FieldName")
End While
End If
If Con.State = ConnectionState.Open Then Con.Close()
