please help with login error

supersyed

New member
Joined
Sep 1, 2009
Messages
1
Programming Experience
Beginner
Hello

Im trying to create a login page which accesses a mysql database

I keep getting this error: reference to a non shared member requires an object reference

heres the line of code
: Dim reader As System.Data.SqlClient.SqlDataReader = New System.Data.SqlClient.SqlCommand(SqlDataSource.ConnectionString)



heres the code for the rest of the page:

Imports System.Data.Odbc

Partial Class director
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Session("Check") <> Nothing) And Convert.ToBoolean(Session("Check")) Then

If (User.Identity.IsAuthenticated) Then
Response.Redirect("f_main.aspx")

End If
End If
End Sub
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate

Dim blnResult As Boolean = False

blnResult = SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)

If (blnResult) Then

Session("Check") = True

e.Authenticated = True

Else

Session("Check") = False

e.Authenticated = False

End If
End Sub

Protected Function SiteSpecificAuthenticationMethod(ByVal UserName As String, ByVal Password As String) As Boolean


Dim log_statement As String = "SELECT * FROM [user] where username='" & UserName & "' and password='" & Password & "'"
Dim con2 As System.Data.SqlClient.SqlCommand

Dim con1 As System.Data.SqlClient.SqlConnection
Dim reader As System.Data.SqlClient.SqlDataReader = New System.Data.SqlClient.SqlCommand(SqlDataSource.ConnectionString)

con1.Open()
con2 = New System.Data.SqlClient.SqlCommand(log_statement, con1)

reader = con2.ExecuteReader()

If reader.Read Then

Return True

Else

Return False

End If

End Function
End Class


Please help me fix this

Thanks
 

alander

Well-known member
Joined
Jun 26, 2007
Messages
120
Location
Singapore
Programming Experience
5-10
Top Bottom