未排序列表中的数据库数据 [英] Database data in unorderlist

查看:68
本文介绍了未排序列表中的数据库数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用asp.net在未排序列表中显示数据库数据

how to show database data in unorderlist using asp.net

推荐答案

如果您的数据库是SQL Server:
If your database is SQL Server:
SqlConnection con=new SqlConnection("connection string");
SqlCommand com=new SqlCommand("SELECT field1 FROM table");

con.Open();
SqlDataReader dr=com.ExcuteReader();
Response.Write("<ol>");
while(dr.Read())
{
Response.Write("<li>");
Response.Write(dr[0].ToString());
Response.Write("</li>");
}
Response.Write("</ol>");
con.close();



这是解决问题的示例方法.



This is so sample way to resolve the issue.


这篇关于未排序列表中的数据库数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆