如何将数据加载到表中,假设表名为employee

解决方案 »

  1.   

    insert into empoyee(属性)values(值)
      

  2.   

     
             拖一个控件DefaultView;
             SqlConnectionStringBuilder stringconntion = new SqlConnectionStringBuilder();
                stringconntion.DataSource = @".\sqlexpress";
                stringconntion.InitialCatalog = "student";//数据库名;
                stringconntion.IntegratedSecurity = true;
                SqlConnection mycommed = new SqlConnection(stringconntion.ConnectionString);//连接数据库;
                mycommed.Open();//打开; string path = "select * from employee ";            adap = new SqlDataAdapter(path, mycommed);            adap.Fill(ds, "employee");            this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
      

  3.   

    如果是把数据从数据库中取出的话strin connStr="......":
    SqlConnection conn=new SqlConnection(connStr);
    conn.Open();
    string cmdStr="select语句";SqlDataAdapter  dataAdapter=new(cmdStr,conn);DataSet ds=new DataSet();
    dataAdapter.Fill(ds."employee");......