设为首页
加入收藏
发布文章
  首页   操作系统   系统集成   程序设计   网站设计   图形图象   安全技术   反击技术   硬件DIY   认证考试   免费资源
当前位置:中国E盟 -=> 程序设计 -=> 数据库 -=> 正文  
beta2中的SqlConnection和SqlCommand << 轻轻松松搞定数据库链接 | SQL Programming using .NET >> 
 发布日期:2006-6-12 17:40:26 发布者:[未知]  来源:[本站]  浏览:[]  评论:[ 字体:   

In this article, you'll see how to use SqlConnection and SqlCommand ADO.NET objects. First thing is, namespaces. There is no namespace called System.Data.SQL any more. IT has been changed with System.Data.SqlClient. See http://www.c-sharpcorner.com/Beta%202/adonet1.asp for more details.

If you had program in Beta 1, your code would look like this -
如果你用beta1编过程序,你的代码会看起来象下面的样子
<%@ Import Namespace="System.Data.SQL" %>
SQLDataReader myReader;
SQLConnection myConnection = new SQLConnection("server=localhost;uid=sa;pwd=sa;database=Shivani");
SQLCommand myCommand = new SQLCommand("Select * from ShivaniArea, myConnection);

try
{
myConnection.Open();
myCommand.Execute(out myReader);

while (myReader.Read())
{

// Retrieve the fields  
}
  



and now new version of Beta 2 looks like this -
现在新版本的Beta2中看起来这样
  
<%@ Import Namespace="System.Data.SqlClient"%>
SqlDataReader myReader;

SqlConnection myConnection = new SqlConnection("server=localhost;uid=sa;pwd=sa;database=Shivani");
SqlCommand myCommand = new SqlCommand("Select * from ShivaniArea", myConnection);
try
{
      myConnection.Open();
      myReader = myCommand.ExecuteReader;

while(myReader.Read())
{
    //Retrieve the fields
}
}  

During the testing of my mobile applications, I noticed more problems working with Beta 1 code. I was having problem working with the TagPrefix. Any way .. I'll be coming with more articles on this matter soon and keep updating you on Beta 2. In my next article, I will discuss how to deal with the problem of losing the DocumentNavigator Class in XML and take the real use of XMLDocument Class.


]]>
打印 】【 收藏 】【 推荐 】 
相关文章 推荐文章 热门文章
BETA2中操作SQL数据库[6.12]
 ·暂无
Sql Server置疑数据库解决方法..
AccessDiver中文使用指南
分页技术:Oracle "rownum..
在ASP中使用SQL Server和M..
在ASP中使用SQL语句之7:ORDE..
 评一评
正在读取…
  笔名:
  评论:
   
【注】 发表评论必需遵守以下条例:
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款

设置首页 - 加入收藏 - 关于我们 - 联系我们 - 友情连接 - -

Copyright ©2006-2008 中国E盟 Powered By:www.chinaE.org

湘ICP备05004075号