Website Login Error

心已入冬 提交于 2019-12-11 19:19:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!