TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
learner
NA
11
0
asp.net (C#)-simple Login page
Nov 24 2009 12:32 PM
Hi friends, i have created a simple login page with ASp.Net(C#)web application. I have 2 txtbox for userid and password,and 1 buuton for submit. i created a database NorthWind and a table Usertbl with 3 coumns (Usedid,username,Password)and added Admin as username and password manually. im getting error msg as some SQLException. My Web.config is
And code is now protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConn = new SqlConnection(ConfigurationManager.AppSettings["strConn"]); SqlCommand myCmd = new SqlCommand("select UserName, password from Usertbl where UserName='"+TextBox1.Text+"' and password='"+TextBox2.Text+"'", myConn); myCmd.Connection = myConn; myConn.Open(); SqlDataReader rdLogin = myCmd.ExecuteReader(); if (rdLogin.HasRows) { Response.Redirect("abc.aspx", false); } else { Lblerror1.Text = "Invalid User Id / Password"; } myConn.Close(); } But Im getting error in myConn.Open(); Error is SQLException was handled by user code.( A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)) How to proceedd?
Reply
Answers (
3
)
Fingerprint Scanner in Web
Perform action based on contextmenustrip value