惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Vulnerabilities – Threatpost
GbyAI
GbyAI
P
Proofpoint News Feed
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
A
About on SuperTechFans
T
Tenable Blog
M
MIT News - Artificial intelligence
IT之家
IT之家
I
Intezer
D
DataBreaches.Net
爱范儿
爱范儿
T
Threatpost
C
CERT Recently Published Vulnerability Notes
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
K
Kaspersky official blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
Cyberwarzone
Cyberwarzone
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AWS News Blog
AWS News Blog
博客园 - 聂微东
C
Check Point Blog
S
Securelist
有赞技术团队
有赞技术团队
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
D
Docker
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
L
Lohrmann on Cybersecurity
G
Google Developers Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog

博客园 - EA_Games

ASP.NET常用代码 - EA_Games - 博客园 Oracle中的OMS的代理服务启动不了的问题 .Net术语大全 DataGrid中的数据导入到Word和Excel_C# NHibernate 进阶 用Nhibernate怎么实现数据的添加、删除、修改简单程序 每个开发人员现在应该下载的十种必备工具 nhibernate入门系列: one-to-one映射 nhibernate入门系列: one-to-many映射 NHibernate快速指南 nhibernate入门系列: 对象持久化操作 ASP.NET 安全认证(三) -- 一点补充(或者叫优化) ASP.NET 安全认证(一) ASP.NET 安全认证(二) Winform如何存入、读取SQL SERVER数据库图片 无法运行ASP.NET Web应用程序 选择VB.Net还是C# ASP.NET中在线用户统计 ASP.NET数据库中图片存储及读取
在asp.net中访问sql server - EA_Games - 博客园
EA_Games · 2005-10-22 · via 博客园 - EA_Games

在asp.net中访问sql server数据库有两种方法,它们是system.data.oledb和system.data.sqlclient.下面这段程序以system.data.sqlclient为例访问本地数据库服务器.
  首先导入名字空间:system.data和system.data.sqlclient.详细代码看源程序.
<%@ import namespace="system.data" %>
<%@ import namespace="system.data.sqlclient" %>
<html>
<script language="c#" runat="server">
   protected void page_load(object src, eventargs e ) 
   {
      sqlconnection myconn = new sqlconnection("server=localhost;uid=sa;pwd=;database=pubs");
        //创建对象sqlconnection
      string strsql="select au_id,au_lname,au_fname,phone,address,city,zip from authors";
      sqldataadapter mycmd = new sqldataadapter(strsql, myconn);
 //创建对象sqldataadapter
      dataset ds = new dataset();
 //创建对象dataset
      mycmd.fill(ds);
 //填充数据到dataset
      dataview source = new dataview(ds.tables[0]);
      mydatagrid.datasource = source ;
      mydatagrid.databind();
 //将数据绑定到datagrid
   }
</script>
<body>
   <h3><font face="verdana">simple select to a datagrid control
   </font></h3>
   <asp:datagrid id="mydatagrid" runat="server"
      width="600"
      backcolor="#ccccff" 
      bordercolor="black"
      showfooter="false" 
      cellpadding=3 
      cellspacing="0"
      font-name="verdana"
      font-size="8pt"
      headerstyle-backcolor="#aaaadd"
      maintainstate="false"
   />
</body>
</html>

posted on 2005-10-22 14:16  EA_Games  阅读(351)  评论()    收藏  举报