Shirley Tan

Shirley Tan

  • NA
  • 1
  • 0

problem with retrieving data from MS access database

Oct 31 2007 5:09 AM
I have problem in this. E error keep prompting that i cannot convert string into integer. FYI: I am using Visual Web Developer 2005 Express edition
Here's is my code..

 Protected Sub btnRetrieve_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Username As String
        Username = CType(txtUsername.Text, String)
        
        Dim DBConnection As Data.OleDb.OleDbConnection = New Data.OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("~/App_data/project.mdb"))
        DBConnection.Open()
        Dim SQLString As String = "Select Password FROM Membership WHERE Username = '" & txtUsername.Text & "'"
        Dim DataTableReader As Data.OleDb.OleDbDataReader
        Dim DBCommand As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand(SQLString, DBConnection)
        DataTableReader = DBCommand.ExecuteReader(SQLString)
        If DataTableReader.Read Then
            If Not IsDBNull(DataTableReader("Password")) Then
                Label1.Text = DataTableReader("Password")
            End If
        End If
        DBConnection.Close()
          
    End Sub

Thanks..