[Asp.Net]实现提取数据到table中 不用服务器控件
2010-04-16 09:43
344 查看
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>
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>
相关文章推荐
- 在ASP.NET中不用服务器控件来实现查询所有的数据列表
- 一个在ASP.NET中利用服务器控件GridView实现数据增删改查的例子
- asp.net 2.0下一个标准GRIDVIEW功能的实现(不用datasource控件)
- 将ASP.net中的Table中的数据导入到Execl(修改后可支持各种控件和文件)
- asp.net 2.0下一个标准GRIDVIEW功能的实现(不用datasource控件)
- ASP.NET中的DataList控件编码实现数据绑定、删除、更新等操作
- 利用反射实现ASP.NET控件和数据实体之间的双向绑定,并且在客户端自动验证输入的内容是否合法
- 用DataList控件和ObjectDataSource在ASP.NET 2.0中实现高效能数据分页
- Asp.Net实现无刷新文件上传并显示进度条(非服务器控件实现)
- 在ASP.NET中使用ObjectDataSource数据控件实现插入新记录
- 【转】ASP.NET中服务器控件Table动态生成表格及其属性介绍
- 转载:Ajax 实现在WebForm中拖动控件并即时在服务端保存状态数据 (Asp.net 2.0)(示例代码下载)
- ASP.NET数据绑定控件数据项中的服务器控件注册JS方法
- asp.net中不使用服务器控件,直接post 表单数据到server
- Asp.Net实现无刷新文件上传并显示进度条(非服务器控件实现)
- 备忘:asp.net简单实现服务器控件的动态绑定
- ASP.NET2.0中Tabs的简单实现 不用Asp.net Ajax ControlToolKit中的Tabs控件实现Tabs效果的简单实现方法:
- Ajax 实现在WebForm中拖动控件并即时在服务端保存状态数据 (Asp.net 2.0)(示例代码下载)
- asp.net不用服务器控件
- dhl:ASP.NET MVC + Jquery实现Ajax下拉框数据2或3级联动(+用户控件)