日期:2014-05-17  浏览次数:20742 次

各位大神帮我看下这什么情况啊!!!!!!!!!!
using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "select * from T-Users where UserName=@UserName";
                    cmd.Parameters.Add(new SqlParameter("UserName", txtUserName.Text));
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            int errorTimes = reader.GetInt32(reader.GetOrdinal("ErrorTimes"));
                            if (errorTimes > 3)
                            {
                                MessageBox.Show("错误次数大于3次,登录失败!");
                                return;
                            }
                            string dbpassword = reader.GetString(reader.GetOrdinal("PassWord"));
                            if (dbpassword == txtPassWord.Text)
                            {
                                MessageBox.Show("登录成功!");
                            }
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
运行时提示红色附近有语法错误......


------解决方案--------------------
[T-Users]
你这表名也太...
------解决方案--------------------
带中划线的表名需要用中括号括起来
SELECT * FROM