SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["xys"].ConnectionString);
conn.Open();
SqlDataAdapter b = new SqlDataAdapter("select count(*) from xys_plus_company_UserInfo where joinin is not null", conn);
DataTable x = new DataTable();
b.Fill(x);
conn.Close();
this.ytxt.Text = b.Fill(x).ToString();
conn.Open();
SqlDataAdapter b = new SqlDataAdapter("select count(*) from xys_plus_company_UserInfo where joinin is not null", conn);
DataTable x = new DataTable();
b.Fill(x);
conn.Close();
this.ytxt.Text = b.Fill(x).ToString();
conn.Open();
SqlDataAdapter b = new SqlDataAdapter("select count(*) from xys_plus_company_UserInfo where joinin is not null", conn);
DataTable x = new DataTable();
b.Fill(x);
conn.Close();
if (x != null && x.Rows.Count = 1)
{
this.ytxt.Text = b.Rows[0][0].ToString();
}
if(b.Fill(x).Rows.Count>0)
{
this.ytxt.Text = b.Rows[0]["字段名"].ToString(); //如果你取到不是条记录 那么就要去循环b.Fill(x)了 b.Fill(x) 返回的是一个 datatable你不能直接赋值给text只能b.Rows[0]["字段名"].ToString();
}
{
this.ytxt.Text = b.Rows[0][0].ToString();
}
后面根据你们的提示将B改为X就好了