从表里读数据,然后把读出的行记录分别辅值给textBox.
不懂,请教,不丢人``

解决方案 »

  1.   

    textbox.text=table.rows[i][j].tostring();
    i和j是表里的行列标
      

  2.   

    你是用什么渎值的
    是用datareader吗?
    textbox.text=dr.[]
      

  3.   

    两个方法都行啊,建议用datareader
      

  4.   

    用sqldataadpater读取到dataset,然后想从dataset中的datatable读值到textbox
    string selString2 = "select * from CostInvoice_TT where GoodsNumber = '"+goodsNumber+"'";
    this.sqlDataAdapter2.SelectCommand.CommandText = selString2;
    this.sqlDataAdapter2.SelectCommand.CommandType = CommandType.Text;
    this.sqlDataAdapter2.SelectCommand.Connection = this.sqlConnection1;
    this.dataSet12.Clear();
    this.sqlDataAdapter2.Fill(this.dataSet12,"CostInvoice_TT");
    .....     //这里不知道怎么写``
    textBox1.Text = DataTable.Rows[1][1].ToString();
      

  5.   

    楼主这样 问想必 读取出来的 记录 只有一条了 DataSet ds= // 返回记录集 this.textbox1.Text=ds.tables[0].rows[0]["列名"].tostring();
     this.textbox2.Text=ds.tables[0].rows[0]["列名"].tostring();
      

  6.   

    搞定了。
    string selString2 = "select * from CostInvoice_TT where GoodsNumber = '"+goodsNumber+"'";
    this.sqlDataAdapter2.SelectCommand.CommandText = selString2;
    this.sqlDataAdapter2.SelectCommand.CommandType = CommandType.Text;
    this.sqlDataAdapter2.SelectCommand.Connection = this.sqlConnection1;
    this.dataSet12.Clear();
    this.sqlDataAdapter2.Fill(this.dataSet12,"CostInvoice_TT");
    textBox1.Text = this.dataSet12.Tables["CostInvoice_TT"].Rows[0][1].ToString();
      

  7.   

    用sqldataadpater读取到dataset,然后想从dataset中的datatable读值到textbox
    string selString2 = "select * from CostInvoice_TT where GoodsNumber = '"+goodsNumber+"'";
    this.sqlDataAdapter2.SelectCommand.CommandText = selString2;
    this.sqlDataAdapter2.SelectCommand.CommandType = CommandType.Text;
    this.sqlDataAdapter2.SelectCommand.Connection = this.sqlConnection1;
    this.dataSet12.Clear();
    this.sqlDataAdapter2.Fill(this.dataSet12,"CostInvoice_TT");
    .....     //这里不知道怎么写``
    textBox1.Text = DataTable.Rows[1][1].ToString();
    =======================================================================
    填充 到  dataSet12 之后,,就用 这个记录集textBox1.Text =dataSet12.Tables[0].Rows[1][1].ToString(); 依次类推..................