Code: Select all
Try
PgSqlConnection1.Open()
command = PgSqlConnection1.CreateCommand()
Dim uparam, pparam As New CoreLab.PostgreSql.PgSqlParameter
command.Parameters.Add("uparam", TextBox1.Text)
command.Parameters.Add("pparam", TextBox2.Text)
command.CommandText = "select * from authuser where uname = :uparam AND passwd = :pparam"
command.Prepare()
Dim readata As CoreLab.PostgreSql.PgSqlDataReader = command.BeginExecuteReader()
While readata.Read()
Dim rowdata As CoreLab.PostgreSql.PgSqlRow = readata.GetPgSqlRow(0)
If rowdata Is Nothing Then
Label3.Text = "Retry Incorrect login or password "
PgSqlConnection1.Close()
Else
Me.Hide()
base.Show()
End If
End While
Catch ex As Exception
MsgBox("An Error occured please contact administrator" & Chr(13) & ex.Message)
End Try
unable to cast object of type 'system.runtime.remoting.messageing.asyncresult' to type
'corelab.postgreSQL.pgsqldatareader'
This code simply checks the username and password in the database if a result row is returned login else exit