04-05-14, 06:19 PM
-
استبدل الكود بما يلي وجرب.... (مراجعة ثانية)
استبدل الكود بما يلي وجرب.... (مراجعة ثانية)
كود :
Dim sql As String = " "
Dim where As String = " "
Dim firstcont As Boolean = True
If txtquery1.Text.Trim() <> "" Then
If firstcont = False Then
where &= " WHERE [id] LIKE '%" & txtquery1.Text.Trim() & "%'"
Else
firstcont = False
where &= " WHERE [id] LIKE '%" & txtquery1.Text.Trim() & "%'"
End If
End If
sql = " SELECT * FROM [patient] " & where
Dim da As New SqlDataAdapter(sql , sqlcon)
Dim dt As New DataTable
If da.Fill(dt) > 0 Then
Dim row As DataRow = dt.Rows(0)
'txtrec1.Text = row.Item(" id ")
txtname.Text = row.Item("name")
txtid.Text = row.Item("id")
cbojob.SelectedValue = row.Item("jobid")
txtdate.MyText = row.Item(" date")
txttel.Text = row.Item("tel ")
txtphone.Text = row.Item(" phone")
txtaddress.Text = row.Item(" address")
txtcomment.Text = row.Item("comments")
Else
lblerror.BackColor = Color.Red
lblerror.BackColor = Color.White
lblerror.Text = "السجل غير موجود "
End If


