求大神帮忙看看哪里出错了。提示说order附近出错、在线等!
visual吧
全部回复
仅看楼主
level 1
丽水特产 楼主
SqlConnection c44 = new SqlConnection(DBHelper.cnnStr);
             try
             {
                 c44.Open();
                 SqlCommand cmd = new SqlCommand(string.Format("select count(*) from order"), c44);
                 int t = (int)cmd.ExecuteScalar();
                 if (t == 0)
                 {
                     MessageBox.Show("数据库连接错误!");
                     return;
                 }
                 cmd.CommandText = string.Format("insert into order values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox6.Text, textBox5.Text, textBox7.Text);
                 int r = cmd.ExecuteNonQuery();
                 if (r > 0)
                 {
                     MessageBox.Show("购买成功!");
                     this.Close();
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             finally
             {
                 c44.Close();
             }
order是Taobao数据库下的一张订单表
运行这个程序之前已经和Taobao进行了连接
2011年03月02日 03点03分 1
level 1
丽水特产 楼主
这就沉了?
2011年03月02日 03点03分 2
1