2
Contributors
5
Replies
12
Views
4 Years
Discussion Span
Last Post by JorgeM
0

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?

0

@JorgeM: This is happenening online.

I will enclose a snapshot og it for you.
e6d5ffa5a8350693ff69817810f915c8

0

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...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.