Dim sql As String
sql = "select * from Report_Details where ReportCode like'%" & txtValue.Text & "%'"
Dim cmd As New OleDbCommand(sql, conn)
Dim adapter As New OleDbDataAdapter(cmd)
Dim data As New DataSet()
adapter.Fill(data, "rp") 'มัน Error ตัวสีเหลืองว่า No value given for one or more required parameters.
DataGridView.DataSource = data.Tables("rp")
Dim conStr As String
conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Search KTB\Search BI\Search BI\BI_Report.accdb;"
Dim conn As New OleDbConnection(conStr)
conn.Open()
Dim sql As String
Dim keyword As String
keyword = txtValue.Text
sql = "select * from Report_Details where Report Code like '%" & keyword & "%'"
Dim cmd As New OleDbCommand(sql, conn)
Dim adapter As New OleDbDataAdapter(cmd)
Dim data As New DataSet()
adapter.Fill(data, "rp")
DataGridView.DataSource = data.Tables("rp")
conn.Close()
Private Sub BtnSearch_s_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch_s.Click
Dim sqlSearch As String
Dim dr As MySqlDataReader
Dim dt As DataTable
Dim comSearch = New MySqlCommand
Try
sqlSearch = "Select * from up_softwares where Up_Names like '%" & txtName_s.Text.Trim() & "%'order by Up_ID asc"
With comSearch
.CommandType = CommandType.Text
.CommandText = sqlSearch
.Connection = DBConn
comSearch.Parameters.AddWithValue("up_softwares", MySqlDbType.VarChar).Value = txtName_s.Text.Trim()
dr = .ExecuteReader()
If txtName_s.Text = "" Then
MessageBox.Show("ไม่พบข้อมูล (NO DATA DONT SHOW")
txtName_s.Clear()
txtName_s.Focus()
ElseIf dr.HasRows Then
dt = New DataTable()
dt.Load(dr)
DataGridView1.DataSource = dt
FormatALLEmployees()
Else
MessageBox.Show("ไม่พบข้อมูล (NO DATA DONT SHOW")
txtName_s.Clear()
txtName_s.Focus()
End If
End With
dr.Close()
Return
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub