All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
独家:C#数据库操作的三种经典用法_.net资料_编程技术
技巧:ASP.NET设计中的性能优化问题_.net资料_编程技术
ASP.NET应用技巧:关于HtmlForm控件_[Asp.Net教程]
扩展,GridView,控件,-,支持,Excel,及,Word,汇出_[Asp.Net教程]
ASP.Net生成一个简单的图片_[Asp.Net教程]
上传图片生成略缩图“最佳解决”_[Asp.Net教程]
教程:XSLT,Designer快速入门指南_.net资料_编程技术
数据库人员手边系列:SQL Server安全列表_[SQL Server教程]
Asp.net关于Header/title/Meta,tages/Style操作的小技巧_[Asp.Net教程]
三层Web体系结构里的两种数据绑定模式_.net资料_编程技术
Reading number is top 10 pictures
玩手机对身体不好
Average female college students3
The most popular girls welcome eggplant
Chinese paper-cut grilles art appreciation2
男人巳快沦落成动物了
In the world the most mysterious 21 place landscape3
美丽的风景--让你目瞪口呆
关于海盗的研究2
NeedWallpaper6
yy365网站上的美女1
Download software ranking
Unix video tutorial19
Love the forty days
Boxer's Top ten classic battle5
VC++6.0培训教程
Unix video tutorial17
Jinling thirteen stock
Tram sex maniac 2 (H) rar bag17
Ashlynn Video3
C++编程教程第三版
asp.netWeb服务器高级编程
delv published in(发表于) 2014/1/10 6:23:35 Edit(编辑)
ADO.NET中的sql连接_[Asp.Net教程]

ADO.NET中的sql连接_[Asp.Net教程]

ADO.NET中的sql连接_[Asp.Net教程]

using System.Data; // Use ADO.NET namespace
using System.Data.SqlClient;

SqlConnection thisConnection = new SqlConnection(
@"Data Source=GY; Initial Catalog=northwind;uid=sa;password=datadog"); //先建立连接
thisConnection.Open();//打开连接
SqlCommand thisCommand = thisConnection.CreateCommand();//直接指定conn的command
也可以这样 // SqlCommand cmd = new SqlCommand();
// cmd.Connection = thisConnection;
cmmand的sql命令
thisCommand.CommandText = "SELECT CustomerID, CompanyName from Customer";
SqlDataReader thisReader = thisCommand.ExecuteReader();//sqldatareader不可以用new 必须直接与command关联
//用reader读出表
while (thisReader.Read())
{
// Output ID and name columns
Console.WriteLine("t{0}t{1}",
thisReader["CustomerID"], thisReader["CompanyName"]);
// Close reader 用完要关闭
thisReader.Close();


// Close connection
thisConnection.Close ()


来源:博客园


http://www.cnblogs.com/redcar/archive/2006/11/23/569859.html







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.