| | |
problem in the login code
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2009
Posts: 4
Reputation:
Solved Threads: 0
The following is my login code for my project..
Basically this code is to fetch the userid and password from the database and perform the validation for the login form.
i performed the debugging activity and after line17 the execution jumps to line 22 i.e an exception is gettin occured..
pls suggest some solution.
ASP.NET Syntax (Toggle Plain Text)
Function ValidateUser(ByVal uid As String, ByVal pwd As String) As Boolean 'Dim sName As String Dim sUser As String Dim sPwd As String Dim blnValidUser As Boolean blnValidUser = True Dim strConn As String = "server=YOGESH\SQLEXPRESS;Trusted_Connection=yes;database=jobbunch.mdf" 'Dim MySQL As String = "Select [Name], [Login], " & _ '"[Password] from Employees " & _ '"Where Login=@uid AND Password=@Pwd" Dim MySQL As String = "Select [uid],[pwd] from login where uid=@uid and pwd=@pwd " Dim MyConn As New SQLConnection(strConn) Dim objDR As SQLDataReader Dim Cmd As New SQLCommand(MySQL, MyConn) Cmd.Parameters.Add(New SqlParameter("@uid", uid)) Cmd.Parameters.Add(New SqlParameter("@pwd", pwd)) MyConn.Open() Try objDR = Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection) While objDR.Read() sUser = objDR("uid") sPwd = objDR("pwd") 'sName = objDR("Name") End While 'Dim sText As String 'If sFirst = "" And sLast = "" Then ' blnValidUser = "False" 'Else ' blnValidUser = "True" 'Session("Name") = sUser 'End If Catch ex As Exception blnValidUser = "False" 'lblError.visible = "true" 'lblError.text = "Sorry Errors have occurred" Finally ValidateUser = blnValidUser MyConn.Close() End Try End Function
Basically this code is to fetch the userid and password from the database and perform the validation for the login form.
i performed the debugging activity and after line17 the execution jumps to line 22 i.e an exception is gettin occured..
pls suggest some solution.
Last edited by peter_budo; Feb 15th, 2009 at 11:17 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Feb 2009
Posts: 4
Reputation:
Solved Threads: 0
@serkan
but in the project v r using sql server which contains the database for all users..
so v need to connect the .net application to sql server database and then execute the queries..
but if dis can be done in another way..pls suggest how to do it exactly..
thanx
@aneesh
i dont know wht kind of exception it is?
just bcoz the control is jumpin to catch statement i came 2 know ki an exception is gettin occured
but in the project v r using sql server which contains the database for all users..
so v need to connect the .net application to sql server database and then execute the queries..
but if dis can be done in another way..pls suggest how to do it exactly..
thanx
@aneesh
i dont know wht kind of exception it is?
just bcoz the control is jumpin to catch statement i came 2 know ki an exception is gettin occured
•
•
Join Date: Dec 2008
Posts: 104
Reputation:
Solved Threads: 18
Rewrite your catch block like this and let me know what message u get on the label
ASP.NET Syntax (Toggle Plain Text)
Catch ex As Exception blnValidUser = "False" lblError.visible = "true" 'Displays exception message on label lblError.text = ex.Message
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- login code problem (VB.NET)
- login (ASP)
- login check (ASP)
- login code in C#(its urgent) (C#)
- Login Problems with Hotmail (Web Browsers)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- php help needed for login (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: Adding a textbox dynamically
- Next Thread: linkbutton
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dialog dropdownmenu dynamic edit embeddingactivexcontrol expose feedback findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list menu mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings rotatepage save search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking treeview typeof unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml youareanotmemberofthedebuggerusers






