28-04-16, 11:36 AM
(27-04-16, 05:39 PM)amgad525 كتب :اشكرك اخي ولكن اريد عند كتابة الاسم وعند عدم وجود الاسم تظهر مسج بوكسكود :
If txtname.Text.Trim = String.Empty Then
MsgBox("يرجى ادخال الاسم لغرض البحث")
Exit Sub
End If
Try
Dim cmd As New SqlCommand("Select [id_name] From [tb] Where [name] = @name", conn)
cmd.Parameters.AddWithValue("@name", txtname.Text.Trim)
conn.Open()
txtid.Text = cmd.ExecuteScalar()
conn.Close()
Catch ex As Exception
If conn.State = ConnectionState.Open Then conn.Close()
MsgBox(ex.Message)
End Try
((نصر من الله وفتح قريب))
