三层结构: 简单问题,在线立马结帐
三层结构:
oalc1.cs下的代码:
public DataSet oanb(String jsz) // 需要处理的文件
{
SqlConnection myConnection = new SqlConnection(
ConfigurationManager.ConnectionStrings[ "OAxitongConnectionString "].ConnectionString);
string cmdText = "select *from fasong1 where jsz= ' " + jsz + " ' order by sj desc ";
SqlDataAdapter sda = new SqlDataAdapter(cmdText, myConnection);
DataSet ds = new DataSet();
try
{
myConnection.Open();
sda.Fill(ds);
}
catch (SqlException ex)
{
throw new Exception(ex.Message, ex);
}
finally
{
myConnection.Close();
}
return ds;
}
index3.aspx.cs下的代码:
private void BindUserData(string yhm)
{
///获取用户数据
///
oalc1 user = new oalc1();
DataSet rr = user.oazb(yhm);
///设置GridView的数据源,并绑定数据
GridView1.DataSource = rr;
GridView1.DataKeyNames = new string[] { "bm " };
GridView1.DataBind();
if(e.item.cell[1].text == "1 ")
{