27-12-23, 02:14 PM
(27-12-23, 02:04 PM)Ashraf Elafify كتب :كود :
DA1 = New OleDbDataAdapter("SELECT * FROM [TbName] WHERE
[Name] LIKE '%" & TName.Text & "%'
Or [FamousName] LIKE '%" & TFamousName.Text & "%'
Or [MotherName] LIKE '%" & TMotherName.Text & "%'
Or [Jobs] LIKE '%" & TJobs.Text & "%'
Or [Plag] LIKE '%" & TPlag.Text & "%'
Or [Address] LIKE '%" & TAddress.Text & "%'
Or [InternationalID] LIKE '%" & TInternationalID.Text & "%'
Or [AccType] LIKE '%" & ComboBox1.Text & "%'
Or [SpeciaM] LIKE '%" & TSpecialM.Text & "%'
Or [IDCard] LIKE %" & TIDCard.Text & "% ", CN1)
DA1.Fill(DT)
DGV1.DataSource = DT
PHP كود :
Dim query As String = "SELECT * FROM [TbName] WHERE " &
"[Name] LIKE ? OR " &
"[FamousName] LIKE ? OR " &
"[MotherName] LIKE ? OR " &
"[Jobs] LIKE ? OR " &
"[Plag] LIKE ? OR " &
"[Address] LIKE ? OR " &
"[InternationalID] LIKE ? OR " &
"[AccType] LIKE ? OR " &
"[SpeciaM] LIKE ? OR " &
"[IDCard] LIKE ?"
DA1 = New OleDbDataAdapter(query, CN1)
' تعيين قيم المعلمات
DA1.SelectCommand.Parameters.AddWithValue("param1", "%" & TName.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param2", "%" & TFamousName.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param3", "%" & TMotherName.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param4", "%" & TJobs.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param5", "%" & TPlag.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param6", "%" & TAddress.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param7", "%" & TInternationalID.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param8", "%" & ComboBox1.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param9", "%" & TSpecialM.Text & "%")
DA1.SelectCommand.Parameters.AddWithValue("param10", "%" & TIDCard.Text & "%")
DA1.Fill(DT)
DGV1.DataSource = DT

