Syntax error in Vb.net form clause

Dim provider As String
Dim dataFile As String
Dim connString As String
Public myConnection As OleDbConnection = New OleDbConnection
Public dr As OleDbDataReader
Public user As String
Public pass As String
Public type As String
Protected Sub Unnamed6_Click(sender As Object, e As EventArgs)


    Provider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source ="
    dataFile = "H:\WebApplication2\WebApplication2\database.accdb"
    connString = provider & dataFile
    myConnection.ConnectionString = connString


    Try
        myConnection.Open()
        Dim g As String = Request.Form("txtusername2").ToString()
        Dim p As String = Request.Form("txtpassword2").ToString()
        Dim str As String
        str = "select * from user-table where username='" & g & "'"


        'pDT = databaseConnector.RunSqlQuery(fulltxtSQL)
        Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)
        dr = cmd.ExecuteReader
        While dr.Read()
            user = dr("username").ToString
            pass = dr("password").ToString
            type = dr("Type").ToString
        End While
        MsgBox(type)

        If pass = p Then
            Session("username") = g
            MsgBox(Session("username"))

            Response.Redirect("Default.aspx")

            MsgBox("thank you for loging in")
        End If
        myConnection.Close()

        Exit Sub

    Catch ex As Exception
        MsgBox(ex.Message.Trim, MsgBoxStyle.Information + MsgBoxStyle.OkOnly)
    End Try

    Exit Sub

End Sub

      

Syntax error in Form am clause is trying to save database variables so I can use them to compare against a text field my database name is database.accdb table name: custom table fields: username, password, type

+3
database vb.net asp.net


source to share


No one has answered this question yet

Check out similar questions:

1
the oledb exception was unhandled
1
ObjectDataProvider with method name, Refresh not working
1
How to access vb.net button click event on modal popup button click event?
0
.executenonquery () No value was specified for one or more required parameters
0
When selecting data from the database (SELECT * FROM), only the last row is read
0
Invalid argument System.Data.OleDb.OleDbException
0
Syntax error in UPDATE vb.net statement in access database
0
Visual Studio 2015 VB.net How to find record in MS Access database and disable button on form?
-1
Asking for advice on developing code: Working with VB.Net and Ms-Access
-1
How can I update the access database from vb.net app



All Articles
Loading...
X
Show
Funny
Dev
Pics