string yzConnStr = "server=breeze-53c40694; userid=sa; password=sa; database=pxfz";
---》string yzConnStr = "server=breeze-53c40694; database=pxfz; uid=sa; pwd=sa;";

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/3107/3107461.xml?temp=.2799341
      

  2.   

    string yzConnStr = "Data Source=breeze-53c40694;Initial Catalog=pxfz;User Id=sa;Password=sa;" ;
      

  3.   

    检查px中aaa,bbb的数据类型
    如果是字符型,需要加上'号
    string SqlInsertStr1 = "INSERT INTO px (aaa,bbb) "+" Values ('"+TextBox1.Text+"','"+TextBox2.Text+"')";
      

  4.   

    谢谢:wangsaokui(无间道III(终极无间))  
    是字符型,加了‘还是不行
      

  5.   

    private void Button1_Click(object sender, System.EventArgs e)
    {
    try
    {
    string yzConnStr = "Data Source=breeze-53c40694;Initial Catalog=pxfz;User Id=sa;Password=sa;" ;
    SqlConnection cnn = new SqlConnection(yzConnStr);
    cnn.Open();
    string SqlInsertStr1 = "INSERT INTO px (aaa,bbb) "+" Values ('"+TextBox1.Text+"','"+TextBox2.Text+"')";
    SqlCommand insert_cmd = new SqlCommand(SqlInsertStr1,cnn);
    insert_cmd.ExecuteNoQuery();
    cnn.Close();
    }
    catch (Exception ex)
    {
       MesssageBox.Show(ex.ToString());
    }
    }
    看看有什么问题!
      

  6.   

    你看看
    后面的语句
    看看你的 command的
    cmd0.ExecuteReader();
    cmd0.ExecuteNonQuery();等,贴上来看看
      

  7.   

    string yzConnStr = "Data Source=breeze-53c40694;Initial Catalog=pxfz;User Id=sa;Password=sa;" ;
    SqlConnection cnn = new SqlConnection(yzConnStr);
    cnn.Open();
    string SqlInsertStr1 = "INSERT INTO px (aaa,bbb) "+" Values ('"+TextBox1.Text+"','"+TextBox2.Text+"')";
    SqlCommand insert_cmd = new SqlCommand(SqlInsertStr1,cnn);
    insert_cmd.ExecuteNoQuery();
    cnn.Close();这样应该可以了