从database读入model,pURL,两列,model用来显示,pURL用来加上链接地图片。代码不知道要怎么写,求。以下的代码,我不知道要怎么把pURL的这个值,加到<a href></a>这里。不能用控件,因为服务器不支持,只能手写代码去连接。就相当于把每个model的都变成超链接,每一个model都和它自己的URL对应好,做成绑定,但是我不知道要代码怎么写。
String strcon = "server=WORKSTAT-EEE298\\SQL2005;Initial Catalog=MPTV;Integrated Security=True; ";
SqlConnection myConn = new SqlConnection(strcon);
SqlDataAdapter da = new SqlDataAdapter("select model from PHONEMODEL where PHONEMODEL.factory= '" + DropDownList1.SelectedItem.Value + "'", myConn); DataSet ds = new DataSet();//创建数据集 da.Fill(ds);//填充 myConn.Close(); int jlh = 0; Response.Write(" <div id='left' style='background-color: #1f3d58; text-align: center; height: 510px;'>"); Response.Write(" <table border='1' class='style2'");
for (int i = 0; i < ds.Tables[0].Rows.Count / 6; i++)
{
Response.Write(" <tr>");
for (int j = 0; j < 6; j++)
{
Response.Write(" <td> <a href='?????' target='_blank'>" + ds.Tables[0].Rows[jlh]["model"].ToString() + " </a> </td>");
jlh++;
}
Response.Write(" </tr>");
}
if (ds.Tables[0].Rows.Count - 1 >= jlh)
{
Response.Write(" <tr>");
for (int j = 0; j < 6; j++)
{
if (jlh <= ds.Tables[0].Rows.Count - 1)
{
Response.Write(" <td> <a href='?????'>" + ds.Tables[0].Rows[jlh]["model"].ToString() + " </a> </td>");
jlh++;
}
else
Response.Write(" <td> </td>");
}
Response.Write(" </tr>");
}
for (int ii = (ds.Tables[0].Rows.Count / 6) + 1; ii <= 10; ii++)
{
Response.Write(" <tr>");
for (int j = 0; j < 6; j++)
{
Response.Write(" <td> </td>");
}
Response.Write(" </tr>");
}
Response.Write(" </table>");
Response.Write("</div>");
String strcon = "server=WORKSTAT-EEE298\\SQL2005;Initial Catalog=MPTV;Integrated Security=True; ";
SqlConnection myConn = new SqlConnection(strcon);
SqlDataAdapter da = new SqlDataAdapter("select model from PHONEMODEL where PHONEMODEL.factory= '" + DropDownList1.SelectedItem.Value + "'", myConn); DataSet ds = new DataSet();//创建数据集 da.Fill(ds);//填充 myConn.Close(); int jlh = 0; Response.Write(" <div id='left' style='background-color: #1f3d58; text-align: center; height: 510px;'>"); Response.Write(" <table border='1' class='style2'");
for (int i = 0; i < ds.Tables[0].Rows.Count / 6; i++)
{
Response.Write(" <tr>");
for (int j = 0; j < 6; j++)
{
Response.Write(" <td> <a href='?????' target='_blank'>" + ds.Tables[0].Rows[jlh]["model"].ToString() + " </a> </td>");
jlh++;
}
Response.Write(" </tr>");
}
if (ds.Tables[0].Rows.Count - 1 >= jlh)
{
Response.Write(" <tr>");
for (int j = 0; j < 6; j++)
{
if (jlh <= ds.Tables[0].Rows.Count - 1)
{
Response.Write(" <td> <a href='?????'>" + ds.Tables[0].Rows[jlh]["model"].ToString() + " </a> </td>");
jlh++;
}
else
Response.Write(" <td> </td>");
}
Response.Write(" </tr>");
}
for (int ii = (ds.Tables[0].Rows.Count / 6) + 1; ii <= 10; ii++)
{
Response.Write(" <tr>");
for (int j = 0; j < 6; j++)
{
Response.Write(" <td> </td>");
}
Response.Write(" </tr>");
}
Response.Write(" </table>");
Response.Write("</div>");
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string name = ds.Tables[0].Rows[0]["email"].ToString();
????处,加上name }
}