I'm doing some practice in VB 2012, I've already connect it to the database in microsoft access 2013. When I run it there's an error in the Select Trans_date from [Transaction] where Trans_date = SYSDATE
here's my code...
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.Odbc
Imports System.Data.DataTable
Public Class Form1
Dim provider As String
Dim dataFile As String
Dim connString As String
Dim myConnection As OleDbConnection = New OleDbConnection
Dim ds As DataSet = New DataSet
Dim da As OleDbDataAdapter
Dim tables As DataTableCollection = ds.Tables
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
provider = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
dataFile = "C:\Users\hp-2\Documents\Visual Studio 2012\Projects\Delta\Delta.mdb"
connString = provider & dataFile
myConnection.ConnectionString = connString
da = New OleDbDataAdapter("Select Trans_date from [Transaction] where Trans_date = SYSDATE"
& t_date.Text & "'", myConnection)
da.Fill(ds, "Transaction")
Dim view1 As New DataView(tables(0))
Dim source1 As New BindingSource()
source1.DataSource = view1
showdata.DataSource = view1
showdata.Refresh()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End Sub
End Class
and here's my error..
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: Syntax error in string in query expression 'Trans_date = SYSDATE''.