#2
apull2021-05-29 22:35
|
程序代码:
private void button2_Click(object sender, EventArgs e)
{
try
{
string num;
string sqltext;
num = textBox17.Text;
sqltext = "select * from structure where num='" + num + "'";
DataSet ds = new DataSet();
ds = SQLHelper.GetDataSet(SQLHelper.str, CommandType.Text, sqltext, null);
textBox16.Text = ds.Tables[0].Rows[0][1].ToString();
textBox15.Text = ds.Tables[0].Rows[0][2].ToString();
textBox14.Text = ds.Tables[0].Rows[0][3].ToString();
textBox13.Text = ds.Tables[0].Rows[0][4].ToString();
comboBox7.Text = ds.Tables[0].Rows[0][5].ToString();
textBox12.Text = ds.Tables[0].Rows[0][6].ToString();
comboBox6.Text = ds.Tables[0].Rows[0][7].ToString();
textBox11.Text = ds.Tables[0].Rows[0][8].ToString();
comboBox5.Text = ds.Tables[0].Rows[0][9].ToString();
textBox10.Text = ds.Tables[0].Rows[0][10].ToString();
textBox17.Text = ds.Tables[0].Rows[0][11].ToString();
}
catch (Exception)
{
throw;//此处报错
}
}
{
try
{
string num;
string sqltext;
num = textBox17.Text;
sqltext = "select * from structure where num='" + num + "'";
DataSet ds = new DataSet();
ds = SQLHelper.GetDataSet(SQLHelper.str, CommandType.Text, sqltext, null);
textBox16.Text = ds.Tables[0].Rows[0][1].ToString();
textBox15.Text = ds.Tables[0].Rows[0][2].ToString();
textBox14.Text = ds.Tables[0].Rows[0][3].ToString();
textBox13.Text = ds.Tables[0].Rows[0][4].ToString();
comboBox7.Text = ds.Tables[0].Rows[0][5].ToString();
textBox12.Text = ds.Tables[0].Rows[0][6].ToString();
comboBox6.Text = ds.Tables[0].Rows[0][7].ToString();
textBox11.Text = ds.Tables[0].Rows[0][8].ToString();
comboBox5.Text = ds.Tables[0].Rows[0][9].ToString();
textBox10.Text = ds.Tables[0].Rows[0][10].ToString();
textBox17.Text = ds.Tables[0].Rows[0][11].ToString();
}
catch (Exception)
{
throw;//此处报错
}
}