•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 392,051 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,288 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 138636 | Replies: 145
![]() |
Yup, I have a pretty good idea what is wrong. You say you get no build errors? Hmm, because here is what the problem is:
You pass in conn for the connection string, but no where in your code do you either declare conn or pass a value for it to retain?
So that is why it just refreshes right back to the Login page.
Hope this helps.
Great code, nice layout, clean, and logical. Well done!
Thanks for the compliments!
SqlCommand cmd = new SqlCommand("proc_ValidateUser", conn);You pass in conn for the connection string, but no where in your code do you either declare conn or pass a value for it to retain?
So that is why it just refreshes right back to the Login page.
Hope this helps.
Great code, nice layout, clean, and logical. Well done!
Thanks for the compliments!
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
:o
Well thanks for the compliments. Glad it worked out.
I enjoying helping everyone here, just glad to see people are using my tutorials. That is enough of a compliment.
Take care....Happy Coding
Well thanks for the compliments. Glad it worked out.
I enjoying helping everyone here, just glad to see people are using my tutorials. That is enough of a compliment.
Take care....Happy Coding
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Jun 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
I'm no Expert by any means . I am just a beginner at asp.net and very willing to learn by other can anyone tell why i get this error. I though I followed the instruction correctly and it is a very good tutorial Paladine thanks.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
login.frmlogin.DBConnection(String strUserName, String strPassword) +473
login.frmlogin.cmdSubmit_Click(Object sender, EventArgs e) +115
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
Unhandled Execution Error
Object reference not set to an instance of an object.
at login.frmlogin.DBConnection(String strUserName, String strPassword)
at login.frmlogin.cmdSubmit_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()
Thanks for the help in advance
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
login.frmlogin.DBConnection(String strUserName, String strPassword) +473
login.frmlogin.cmdSubmit_Click(Object sender, EventArgs e) +115
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
Unhandled Execution Error
Object reference not set to an instance of an object.
at login.frmlogin.DBConnection(String strUserName, String strPassword)
at login.frmlogin.cmdSubmit_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()
Thanks for the help in advance
Well I find that interesting. I used your exact code, with only a minor change (debug="true"" in the web.config file) and it ran perfectly fine.
Have you tried setting the debug mode to true and not false? Try rebuilding the solution, before running the application.
Sorry I can't be of more help, but the code runs fine for me.
Have you tried setting the debug mode to true and not false? Try rebuilding the solution, before running the application.
Sorry I can't be of more help, but the code runs fine for me.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Aug 2005
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
First I am new to coding and db but working hard at learning.
The login page comes up fine and no bugs in the build bet...
In the below code I keep getting an exception error??? I have checked that the MDB and LDB files have R/W for the asp.net user but no luck.
The Error connecting to DB keeps comming up and the username and password are correct.
IIS 5.1
Access DB 2003
VS 2003
Any ideas would be great as the rest seems to be fine....
Thanks Heaps
' ||||| Create OleDb Data Reader
Dim objReader As OleDbDataReader
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
' ||||| Close the Reader and the Connection Closes with it
While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close() ' ||||| Close the Connections & Reader
Return True
End If
End While
Catch ex As Exception
'lblMessage.Text = "Error Connecting to Database!"
Label1.Text = "Error Connecting to Database!"
End Try
The login page comes up fine and no bugs in the build bet...
In the below code I keep getting an exception error??? I have checked that the MDB and LDB files have R/W for the asp.net user but no luck.
The Error connecting to DB keeps comming up and the username and password are correct.
IIS 5.1
Access DB 2003
VS 2003
Any ideas would be great as the rest seems to be fine....
Thanks Heaps
' ||||| Create OleDb Data Reader
Dim objReader As OleDbDataReader
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
' ||||| Close the Reader and the Connection Closes with it
While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close() ' ||||| Close the Connections & Reader
Return True
End If
End While
Catch ex As Exception
'lblMessage.Text = "Error Connecting to Database!"
Label1.Text = "Error Connecting to Database!"
End Try
Well, I need to ask what the error message says. If you could please provide that (more than saying an exception error), I think we can determine what the problem is.
What are the error message details.
What are the error message details.
•
•
•
•
Originally Posted by japelweb
First I am new to coding and db but working hard at learning.
The login page comes up fine and no bugs in the build bet...
In the below code I keep getting an exception error??? I have checked that the MDB and LDB files have R/W for the asp.net user but no luck.
The Error connecting to DB keeps comming up and the username and password are correct.
IIS 5.1
Access DB 2003
VS 2003
Any ideas would be great as the rest seems to be fine....
Thanks Heaps![]()
' ||||| Create OleDb Data Reader
Dim objReader As OleDbDataReader
objReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
' ||||| Close the Reader and the Connection Closes with it
While objReader.Read()
If CStr(objReader.GetValue(0)) <> "1" Then
lblMessage.Text = "Invalid Login!"
Else
objReader.Close() ' ||||| Close the Connections & Reader
Return True
End If
End While
Catch ex As Exception
'lblMessage.Text = "Error Connecting to Database!"
Label1.Text = "Error Connecting to Database!"
End Try
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: Aug 2005
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
Originally Posted by Paladine
Well, I need to ask what the error message says. If you could please provide that (more than saying an exception error), I think we can determine what the problem is.
What are the error message details.
I created a second lable box and sent ex to string and this was the result.
I am also building the SQL version to see how that goes.
Thanks for the help, am learning lots on this one...
System.Data.OleDb.OleDbException: Too few parameters. Expected 4. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at WebListSite.WebForm1.DBConnection(String strUserName, String strPassword) in C:\Documents and Settings\Jason Apel\My Documents\My Webs\WebListSite\AdminLogin.aspx.vb:line 89
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
Other Threads in the ASP.NET Forum
- Previous Thread: Maintaing filter criteria in main page
- Next Thread: Insert,Update,Delete codings.


Linear Mode