Private Function queryDB(ByVal sql As String, ByVal tbl_qry As String) As DataSet
Dim connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & databasePath
Dim oleConn As New OleDb.OleDbConnection(connStr)
ds = New DataSet
Dim dsAdapter As New OleDb.OleDbDataAdapter(sql, oleConn)
'dsAdapter.Fill(ds, tbl_qry)
Dim cmd As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(sql, oleConn)
dsAdapter.SelectCommand = cmd
' Add parameters and set values.
Dim inactiveDate As String = Format(dtp.Value, "M/d/yyyy")
cmd.Parameters.Add("@Date", System.Data.OleDb.OleDbType.VarChar, 15).Value = inactiveDate
cmd.Parameters(0).Direction = ParameterDirection.Input
dsAdapter.Fill(ds, tbl_qry)
Return ds
End Function
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)