读书人

麻烦会的大神帮忙注释一上新手不懂!

发布时间: 2012-09-01 09:33:02 作者: rapoo

麻烦会的大神帮忙注释一下,新手不懂!!!!!
SqlConnection conn = new SqlConnection();//实例化对象
string conStr = @"Data Source=WHIZENDT016\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True";
conn.ConnectionString = conStr;
conn.Open();
SqlCommand cmd = new SqlCommand("select * from Users_id where Id='" + textBox1.Text + "'and Password ='" + textBox2.Text + "'", conn);
SqlDataReader str = cmd.ExecuteReader();
str.Read();

[解决办法]

C# code
           SqlConnection conn = new SqlConnection();//实例化对象            //接字符串            string conStr = @"Data Source=WHIZENDT016\SQLEXPRESS;Initial Catalog=Users;Integrated Security=True";            conn.ConnectionString = conStr;            //打接            conn.Open();            //行sql 命令            SqlCommand cmd = new SqlCommand("select * from Users_id where Id='" + textBox1.Text + "'and Password ='" + textBox2.Text + "'", conn);            //按READER方式行查            SqlDataReader str = cmd.ExecuteReader();            //此次可循READ,逐取得果            str.Read(); 

读书人网 >C#

热点推荐