首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

啊 !大神们

2013-06-26 
求助啊啊 !!大神们 private void button1_Click(object sender, EventArgs e){SqlConnection conn new S

求助啊啊 !!大神们
 private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = "Data Source=(local);Initial Catalog=Tesk;Integrated Security=True";

            conn.Open();;
            string sql = "select @a=pwd from pwd where num='" + textBox1.Text + "'";
            SqlCommand sqlCommand = new SqlCommand(sql, conn);
            sqlCommand.CommandType = CommandType.Text;
            conn.Open();
            string a = sqlCommand.ExecuteScalar();最后一句错了,我只想把pwd的值赋值给a
[解决办法]
sql = "select @a=pwd from pwd where num='" + textBox1.Text + "'";
=〉
sql = "update from pwd set @a=pwd where num='" + textBox1.Text + "'";

热点排行