各位能帮我看看是那里出了错嘛,,
单表(basic)查询时正常..但多表查询就要出错..谢谢了
string SqlSel;
SqlSel = "select Number,Age,Name,Native,Tel,Sex,Email,Folk,DeptName,DDuty from basic "+
"INNER JOIN Dept ON basic.DeptID = Dept.DeptID"+
"where(basic.Number = number)";
SqlCommand sqlComm = new SqlCommand(SqlSel,sqlConnection1);
this.sqlConnection1.Open();
SqlDataReader dr = sqlComm.ExecuteReader();
try
{
if(dr.Read())
{
txtName.Text = dr["Name"].ToString();
this.txtAge.Text = dr["Age"].ToString();
this.txtSex.Text = dr["Sex"].ToString();
this.txtTel.Text = dr["Tel"].ToString();
this.txtNative.Text = dr["Native"].ToString();
this.txtMail.Text = dr["Email"].ToString();
this.txtFolk.Text = dr["Folk"].ToString();
this.txtDept.Text = dr["DeptName"].ToString();
this.txtDuty.Text = dr["DDuty"].ToString();
}
DeptName和DDuty是Dept表的数据.
[求助]多表查询