代码如下::
希望各位前辈指出错误,我在网上也找不到相关解决方法。。
public void papermess_(DateTime pt,model.paper npa )
{
SqlConnection conn=new SqlConnection(dal.sqlconn.sconn);
conn.Open();
SqlCommand cmd=new SqlCommand();
cmd.Connection=conn;
string str1 = model.tmessage.examtable;
cmd.CommandText = "select * from PaperInfo where ExamTimeID='" +pt+ "'";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
//DataTable dt = new DataTable();
//dt = ds.Tables[0];
conn.Close(); npa.etime = ds.Tables[0].Rows[0][11].ToString();
npa.level = ds.Tables[0].Rows[0][10].ToString();
for (int t = 0; t < ds.Tables[0].Rows.Count; t++)
{
npa.sty[t] = ds.Tables[0].Rows[t][1].ToString();
npa.id[t] = ds.Tables[0].Rows[t][2].ToString();
npa.ques[t] = ds.Tables[0].Rows[t][3].ToString();
npa.qa[t] = ds.Tables[0].Rows[t][4].ToString();
npa.qb[t] = ds.Tables[0].Rows[t][5].ToString();
npa.qc[t] = ds.Tables[0].Rows[t][6].ToString();
npa.qd[t] = ds.Tables[0].Rows[t][7].ToString();
npa.qe[t] = ds.Tables[0].Rows[t][8].ToString();
npa.ans[t] = ds.Tables[0].Rows[t][9].ToString();
}
}
希望各位前辈指出错误,我在网上也找不到相关解决方法。。
public void papermess_(DateTime pt,model.paper npa )
{
SqlConnection conn=new SqlConnection(dal.sqlconn.sconn);
conn.Open();
SqlCommand cmd=new SqlCommand();
cmd.Connection=conn;
string str1 = model.tmessage.examtable;
cmd.CommandText = "select * from PaperInfo where ExamTimeID='" +pt+ "'";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
//DataTable dt = new DataTable();
//dt = ds.Tables[0];
conn.Close(); npa.etime = ds.Tables[0].Rows[0][11].ToString();
npa.level = ds.Tables[0].Rows[0][10].ToString();
for (int t = 0; t < ds.Tables[0].Rows.Count; t++)
{
npa.sty[t] = ds.Tables[0].Rows[t][1].ToString();
npa.id[t] = ds.Tables[0].Rows[t][2].ToString();
npa.ques[t] = ds.Tables[0].Rows[t][3].ToString();
npa.qa[t] = ds.Tables[0].Rows[t][4].ToString();
npa.qb[t] = ds.Tables[0].Rows[t][5].ToString();
npa.qc[t] = ds.Tables[0].Rows[t][6].ToString();
npa.qd[t] = ds.Tables[0].Rows[t][7].ToString();
npa.qe[t] = ds.Tables[0].Rows[t][8].ToString();
npa.ans[t] = ds.Tables[0].Rows[t][9].ToString();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货