473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error: No default member found???

Can some one please tell me why I'm getting this error! I presume it is because there is something wrong with my Database connection but am not really sure what!

Thanks

...:: Error ::..
System.MissingMemberException: No default member found for type 'Boolean'.
...:: CODE ::..
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
If Page.IsValid Then
'Connect to Database for User Validation
If DBConnection(txtUserName.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False) ' ||||| default.aspx Page!

Else
' Credentials are Invalid
lblMessage.Text = "Invalid Login!"
End If
End If
End Sub
Function DBConnection()
Dim Myconn As New SqlConnection(ConfigurationSettings.AppSettings("s trConn"))
Dim cmd As New SqlCommand("ValidateUser", Myconn)
cmd.CommandType = CommandType.StoredProcedure

Dim objParam1, objParam2 As SqlParameter

objParam1 = cmd.Parameters.Add("@UserName", SqlDbType.Char)
objParam2 = cmd.Parameters.Add("@Password", SqlDbType.Char)

objParam1.Direction = ParameterDirection.Input
objParam2.Direction = ParameterDirection.Input

objParam1.Value = txtUserName.Text
objParam2.Value = txtPassword.Text

Try
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If

Dim objReader As SqlDataReader
objReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)

While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close()
Return True
End If

End While
Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"
End Try

End Function
Nov 18 '05 #1
1 4009
Hi,

have you made sure that your method returns False if there is a problem and
when the user shouldn't be able to log? It doesn't seem to explicitly return
False in any situation which it needs to do because the return value is
evaluated in If statement.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Tim::.." <myatix_at_hotmail.com> wrote in message
news:AF**********************************@microsof t.com...
Can some one please tell me why I'm getting this error! I presume it is because there is something wrong with my Database connection but am not
really sure what!
Thanks

..:: Error ::..
System.MissingMemberException: No default member found for type 'Boolean'.
..:: CODE ::..
Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click If Page.IsValid Then
'Connect to Database for User Validation
If DBConnection(txtUserName.Text, txtPassword.Text) Then
FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False) '
||||| default.aspx Page!
Else
' Credentials are Invalid
lblMessage.Text = "Invalid Login!"
End If
End If
End Sub
Function DBConnection()
Dim Myconn As New SqlConnection(ConfigurationSettings.AppSettings("s trConn")) Dim cmd As New SqlCommand("ValidateUser", Myconn)
cmd.CommandType = CommandType.StoredProcedure

Dim objParam1, objParam2 As SqlParameter

objParam1 = cmd.Parameters.Add("@UserName", SqlDbType.Char)
objParam2 = cmd.Parameters.Add("@Password", SqlDbType.Char)

objParam1.Direction = ParameterDirection.Input
objParam2.Direction = ParameterDirection.Input

objParam1.Value = txtUserName.Text
objParam2.Value = txtPassword.Text

Try
If MyConn.State = ConnectionState.Closed Then
MyConn.Open()
End If

Dim objReader As SqlDataReader
objReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)

While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close()
Return True
End If

End While
Catch ex As Exception
lblMessage.Text = "Error Connecting to Database!"
End Try

End Function

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
13
by: Duron | last post by:
I created a new folder using VS.NET 2003. Then I created a new web form under that folder, say, \Member\Default.aspx. However, even if I didn't do anything to that page, a run-time error appears...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
12
by: mast2as | last post by:
Hi everyone... I have a TExceptionHandler class that is uses in the code to thow exceptions. Whenever an exception is thrown the TExceptionHander constructor takes an error code (int) as an...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
1
by: spamfree | last post by:
Hello, If anyone can give me some insight as to why this code fails to compile, I would be most appreciative. I have only been able to test it with gcc 3.4.4 and gcc 4.2.1, which both fail with...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.