0

the code seems to be fine dont know why its not working.
when i execute the same sql directly in database it works fine.

the error is get is oledbexception was unhandled syntax error in from clause. please help me thanks is advance.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\abrar\My Documents\Database2.mdb")
        Dim sql As String = "SELECT * FROM Transaction where Due_Date > RentedDate + 30 "
        Dim command As New OleDbCommand(sql, connection)

        Try
            connection.Open()
        Catch ex As InvalidOperationException
            MsgBox(ex.Message)
        End Try

        Dim overDueDVDadapter As New OleDbDataAdapter(command)
        Dim overDueDVD As New DataSet


        overDueDVD.Clear()

        overDueDVDadapter.Fill(overDueDVD, "Transaction")



        reportDataGridView.DataSource = overDueDVD.Tables("Transaction").DefaultView

        If connection.State <> ConnectionState.Closed Then
            connection.Close()
        End If

    End Sub

Edited by mike_2000_17: Fixed formatting

2
Contributors
2
Replies
7
Views
8 Years
Discussion Span
Last Post by abrars
0

"Transaction" is a reserved word. Rename your table to "TransactionTable" or something like that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.