回覆列表
  • 1 # hoh9按時

    //連線你的資料庫

    stringconnstr="server=.;uid=sa;pwd=sa;database=sc";

    using(SqlConnectionconn=newSqlConnection(connstr))

    {

    conn.Open();

    DataSetds=newDataSet();

    SqlDataAdapterda=newSqlDataAdapter(sqlsel,conn);

    da.Fill(ds,"coust");

    DataTabledt=ds.Tables["coust"];

    conn.Close();

    returndt;

    //TODO:這行程式碼將資料載入到表“studentDataSet.studentinfo”中。您可以根據需要移動或移除它。

    //this.studentinfoTableAdapter.Fill(this.studentDataSet.studentinfo);

    //資料繫結

    stringsqlsel="select*fromstudentinfo";

    DataTabledt=bangding(sqlsel);

    cmAmend=(CurrencyManager)BindingContext[dt];

    this.dataGridView1.DataSource=dt;

    this.textBox1.DataBindings.Add("text",dt,"sno");

    this.textBox2.DataBindings.Add("text",dt,"sname");

    this.textBox3.DataBindings.Add("text",dt,"ssex");

    this.textBox4.DataBindings.Add("text",dt,"sage");

    this.textBox5.DataBindings.Add("text",dt,"sclass");

    this.textBox6.DataBindings.Add("text",dt,"sdept");

    this.textBox7.DataBindings.Add("text",dt,"saddress");

    this.textBox8.DataBindings.Add("text",dt,"sphone");

    this.textBox9.DataBindings.Add("text",dt,"sqq");

  • 中秋節和大豐收的關聯?
  • 月經來了.用OB可以去游泳嗎?