日期:2014-05-17 浏览次数:20954 次
SqlConnection conn = new SqlConnection("server=.;database=test;uid=sa;pwd=123456;");
conn.Open();
SqlCommand cmd = new SqlCommand("select [id],[name],[password] from users where name='guwei'", conn);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
this.textBox1.Text = reader.GetInt32(0) + "";
this.textBox2.Text = reader[1].ToString();
this.textBox3.Text = reader.GetValue(2).ToString();
}
SqlCommand cmd = new SqlCommand("select a,b,c from zhengshib where ZCM='" + strREG + "'and ID='" + rjid + "'", data.conn);
DataTable table = DBProvider.DefaultDBOperator.GetDataTable(cmd);
if (table.Rows.Count > 0)
{
DataRow dr=table.Rows[0];
string strA = dr["a"].ToString();
string strB = dr["b"].ToString();
string strC = dr["c"].ToString();
}