Member Avatar

I am recently facing this error in my website.
What is this about ?

Server error in '\' Application

Recommended Answers

ASP.NET is indicating that there is a problem with the page you tried to access. Is this happening on your local machine via the development server (visual studio) or online?

Any other information provided to you on that error page?

Jump to Post

Hmm.. have you tried to use this select statement directly within SQL Studio? The error is indicating a problem with your query. It looks like the value of the user name was not passed correctly. Does the username include an apostrophe? If so, the way you are implementing this is …

Jump to Post

All 5 Replies

ASP.NET is indicating that there is a problem with the page you tried to access. Is this happening on your local machine via the development server (visual studio) or online?

Any other information provided to you on that error page?

Member Avatar

@JorgeM: This is happenening online.

I will enclose a snapshot og it for you.
e6d5ffa5a8350693ff69817810f915c8

Hmm.. have you tried to use this select statement directly within SQL Studio? The error is indicating a problem with your query. It looks like the value of the user name was not passed correctly. Does the username include an apostrophe? If so, the way you are implementing this is problematic. Its generally recommended to use parameterized SQL instead so that these values are treated as literals.

For example here is a c# example....

strSQL = "SELECT COUNT(*) FROM member where Username = @Username AND Password = @Password";
SqlCmd cmd = new SQLCommand(strSQL);
cmd.Parameters.AddWithValue(@Username, txtUsername.Text);
cmd.Parameters.AddWithValue(@Password, txtPassword.Text);
Int32 count = (Int32) cmd.ExecuteScalar();

This code may/may not work as expected as I wrote it from memory...

Member Avatar

@JorgeM: Thanx Alot.

Did you resolve your issue?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.