[Asp.Net]实现提取数据到table中 不用服务器控件

1.后台方法  
    public string id;
    public string usercode;
    public void tbalelist(string strsql)
    {
        string str = string.Empty;
        DBCon OAcon = new DBCon();
        SqlConnection myConn = new SqlConnection(OAcon.getOAcon());
        myConn.Open();
        SqlCommand sc = new SqlCommand(strsql, myConn);
        SqlDataReader sr = sc.ExecuteReader();
        if(sr.Read())
        {
            id=sr[0].ToString();
            usercode = sr[1].ToString();  
        }
        sr.Close();
        myConn.Close();
       
    }
2.前台
         <table align="center" border="0" cellpadding="5" cellspacing="1" width="100%">
                 <tr>
                     <td class="hback" width="5%">
                                    <font color="#cc3300"><b>ID</b></font></td>
                      <td class="hback" width="10%">
                                    <font color="#cc3300"><b>张号</b></font></td>
 
                </tr>
                 <tr>
                     <td class="hback" width="5%"><%= id %></td>
                      <td class="hback" width="10%"><%= usercode %></td>
                </tr>
          </table>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

厦门德仔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值