Protected Sub FindData()
strcon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\DbRegister.accdb"
con.ConnectionString = strcon
con.Open()
Dim sql As String = "SELECT * FROM DbAudit WHERE DateAudit Between @DateS And @DateE"
'Dim DateStart As String = TextBox1.Text
'Dim DateEnd As String = TextBox2.Text
'If Actionddl.Text <> "" Then
' Sql &= " And ActionAudit = '" & Actionddl.Text & "'"
'End If
'If Findtxt.Text <> "" Then
' Sql &= " And ViewAudit Like '%" & Findtxt.Text & "%'"
'End If
cmd = New OleDbCommand(sql, con)
cmd.Parameters.AddWithValue("DateS", TextBox1.Text)
cmd.Parameters.AddWithValue("DateE", TextBox2.Text)
Dim da As New OleDbDataAdapter(sql, con)
ds = New DataSet()
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
Protected Sub FindData()
strcon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\DbRegister.accdb"
con.ConnectionString = strcon
con.Open()
Dim sql As String = "SELECT * FROM DbAudit WHERE DateAudit Between @DateS And @DateE"
'Dim DateStart As String = TextBox1.Text
'Dim DateEnd As String = TextBox2.Text
'If Actionddl.Text <> "" Then
' Sql &= " And ActionAudit = '" & Actionddl.Text & "'"
'End If
'If Findtxt.Text <> "" Then
' Sql &= " And ViewAudit Like '%" & Findtxt.Text & "%'"
'End If
Dim dt As DateTime = DateTime.Today
cmd = New OleDbCommand(sql, con)
cmd.Parameters.Add(New OleDbParameter("@DateS", OleDbType.Date)).Value = dt.AddDays(-10)
cmd.Parameters.Add(New OleDbParameter("@DateE", OleDbType.Date)).Value = dt
Dim da As New OleDbDataAdapter(sql, con)
ds = New DataSet()
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
หรือ พอมีวิธีทำให้ตอน Show Gridview มันตัด เวลาออกได้ไหมคะ
ตอนนี้ติดปัญหานี้ ปัญหาสุดท้ายแล้วค่ะ โปรแกรมนี้ก็จะเสร็จแล้ว แล้วพรุ่งนี้จะเอาไปให้ User ลอง Test (แต่คิดว่า พอตอน Test น่าจะมีมาให้แก้อีกนิดๆหน่อยๆค่ะ)