问题
I created a website login system but when I run it it keeps coming up with this error to the particular bit of coding below.
Error:
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code Additional information: Incorrect syntax near the keyword 'user'."
Code:
public static User LoginUser(string login, string password)
{
//Check if user exists
string query = string.Format("SELECT COUNT(*) FROM TeesDB.dbo.user WHERE name = '{0}'",
login);
command.CommandText = query;
try
{
conn.Open();
int amountOfUsers = (int) command.ExecuteScalar(); **<<<<<<< HERE!!!**
来源:https://stackoverflow.com/questions/22734342/website-login-error