如何用asp.net做oj

来源:百度知道 编辑:UC知道 时间:2024/06/08 19:34:47

//建立数据库连接,取出bigRules表数据放入ds中
SqlConnection conn = new SqlConnection(“server=localhost;uid=sa;pwd=;database=ygpc”;
SqlCommand comm. = new SqlCommand(“select * from bigRules”,conn);
SqlDataAdapter da = new SqlDataAdapter(comm);
DataSet ds;
da.Fill(ds,”bigRules”);
int nTotalBig = ds.Tables[“bigRules”].Rows.Count;
int k = Convert.ToInt32(ds.Tables["bigRules"].Rows[0]["bigID"].ToString());

for(int iBig=0;k<=Convert.ToInt32(ds.Tables["bigRules"].Rows[nTotalBig-1]["bigID"].ToString());k=Convert.ToInt32(ds.Tables["bigRules"].Rows[iBig]["ID"].ToString()))
//iBig代表bigRules表中行值,k代表iBig行对应的ID值
{
string commText = "Select * from smallRules where bigID="+k+"order by id";
SqlCommand commSmall = new SqlCommand(commText,conn);
SqlDataAdapter daSmall = new SqlDataAdapter(commSmall);
if(ds1!=null) ds1.Clear();
ds1 = new DataSet();//每次循环都需