sqlDataAdapter1中的sql语句设定了吗?

解决方案 »

  1.   

    SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter("select * from Table1",sqlConnection1);
      

  2.   

    this.sqlSelectCommand1.CommandText = "SELECT Programer_ID, Programer_Name FROM 项目表";
    这个是系统自动生成的SQL语句应该在哪里设定?
    private void InitializeComponent()内还是private void button1_Click??
      

  3.   

    呵呵看看:
    this.richTextBox1.DataBindings.Clear();
    string constr=@"uid=sa;pwd=111;server=jacky;database=hclab";
    string sql=" select * from notic where ID=(select max(ID) from notic)";
    SqlConnection conn=new SqlConnection(constr);
    try
    {

    SqlDataAdapter da=new SqlDataAdapter(sql,conn);
    DataSet ds=new DataSet();
    da.Fill(ds,"notic");
    da.InsertCommand=new SqlCommand("insert into notic(notic) values ('this.richTextBox1.Text')",conn);
    da.Update(ds,"notic");
    }

    catch(SqlException ex)
    {
    MessageBox.Show("Error"+ex.Message,"登陆失败!");
    }
    finally
    {
    conn.Close();
    }呵呵在用c#写个东西ing~~哈哈
      

  4.   

    constr=@"uid=sa;pwd=111;server=jacky;database=hclab";
    string sql=" select * from notic where ID=(select max(ID) from notic)";
    要看看你的机器里面有什么数据库和表而做改变啊
    上面我还加了数据绑定!呵呵
      

  5.   

    private void button1_Click(object sender, System.EventArgs e)
    {
      try{
         sqlConnection1.Open(); 
     sqlDataAdapter1.Fill(dataSet11, "项目表");
     dataGrid1.DataSource=dataSet11.Tables["项目表"].DefaultView; 
     sqlConnection1.Close(); 
          }
     catch(SqlException err)
    {
      MessageBox.Show(this,err.Massage);
    }
    }
    看一下你出错的原因
      

  6.   

    login fail for user sa
      

  7.   

    顺便问一句,有谁知道哪里有关于用C#编写访问,修改SQL的资料
    最好是电子版的