回 帖 发 新 帖 刷新版面

主题:★ 请关注Asp.net如何连接SQL Server2000数据库★

★ 请关注Asp.net如何连接SQL Server2000数据库★
     
     大家好,以下是有关ASP.net连接SQL Server2000数据库的例程,
     在这里和大家分享一下:
     
     Asp.net连接SQL Server2000数据库例程详解:
     <%@ Import Namespace="System.Data" %>
     <%@ Import NameSpace="System.Data.SqlClient" %>
     <script laguage="VB" runat="server">
     sub page_load(sender as Object,e as EventArgs)
     Dim myConnection As SqlConnection
     Dim myCommand As SqlCommand
     Dim ds as DataSet
     '1.connect to sql server
     myConnection = New SqlConnection( "server=localhost;database=Pubs;uid=ueytjdf;pwd=doekdf" )
     myConnection.Open()
     la1.text="Connection Opened!"
     
     '2.Create a table
     myCommand = New SqlCommand( "CREATE TABLE [test] ([id] [int] IDENTITY (1, 1) NOT NULL ,[name]
     
     [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,[sex] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
     
     )", myConnection )
     myCommand.ExecuteNonQuery()
     la2.text="New table created!"
     
     '2 添加纪录
     myCommand = New SqlCommand( "Insert into [test] (name,sex) values( '黄志文','男' )",
     
     myConnection )
     myCommand.ExecuteNonQuery()
     la3.text="New Record Inserted!"
     
     '3 更新数据
     myCommand = New SqlCommand( "UPDATE [test] SET name='Smith' where name='李明'", myConnection )
     myCommand.ExecuteNonQuery()
     la4.text="Record Updated!"
     
     '4 删除数据
     myCommand = New SqlCommand( "delete from [test] where name='Smith'", myConnection )
     myCommand.ExecuteNonQuery()
     la5.text="Record Deleted!"
     
     '5 用DataGrid显示数据
     myCommand = New SqlCommand( "select * from [test]", myConnection )
     MyDataGrid.DataSource=myCommand.ExecuteReader()
     MyDataGrid.DataBind()
     end sub
     </script>
     <html>
     <body>
     <asp:label id="la1" runat="server" /><br>
     <asp:label id="la2" runat="server" /><br>
     <asp:label id="la3" runat="server" /><br>
     <asp:label id="la4" runat="server" /><br>
     <asp:label id="la5" runat="server" /><br>
     <ASP:DataGrid id="MyDataGrid" runat="server"
     BorderColor="black"
     BorderWidth="1"
     GridLines="Both"
     CellPadding="3"
     CellSpacing="0"
     Font-Name="Verdana"
     Font-Size="10pt"
     HeaderStyle-BackColor="#aaaadd"
     AlternatingItemStyle-BackColor="#eeeeee"
     >
     </asp:DataGrid>
     
     </body>
     </html>

   以下是支持ASP.NET SQL Server2000 的空间供大家参考

     在线申请地址: http://www.now.net.cn/host
    [URL= http://www.now.net.cn/host ][img] http://b.todayisp.com/100x100_now.gif [/img][/url]

     ●商务C型主机
       送CN域名 送800M 空间邮箱 送GCDN全球网络镜像及加速引擎 免费集成繁简通网络商务版 1650 元/年
       详细:http://www.now.net.cn/host/commerce.net
     
     ●增强C型主机
       附送300 Mb邮局空间 送CN域名 送GCDN全球网络镜像及加速引擎 免费集成繁简通网络简装版 720 元/年
       详细:http://www.now.net.cn/host/deluxe.net
   
     ●虚拟专用C型主机
       送CN域名 送2000M VIP 企业邮局 送GCDN全球网络镜像及加速引擎 免费集成繁简通网络商务版 4000 元/年

     ●虚拟专用型D
       4500元/年 3000M的网站空间JSP+SQL server 2000数据库  免费集成繁简通网络商务版
       http://www.now.net.cn/host/vps.net
     
     ★ 凡是企业在本公司购满300元以上,均可获得.CN域名!!!
     
     ★●申请完可以立即网上支付,立即开通您的服务!!●★基本型与增强型免费集成繁简通网络简装版,商务型以上免费集成繁简通网络商务版、GCDN

     时代互联(www.now.net.cn) 的虚拟主机,免费配有 CDN 镜象网络加速 ,送域名 邮箱,流量访问系统,留言版,计数器!
      全球加速网络镜像CDN技术实例:
     CDN客户实例:
     http://www.huihuicheng.com
     http://www.0756.sh
     http://www.zcan.cn
     http://www.qianju.cn
     http://www.molongjy.com/

     主机详细配置和在线订购: http://www.now.net.cn/host/
     优惠套餐: http://www.now.net.cn/special/
  
联系我们:  全球免费咨询电话 http://www.now.net.cn/customer/moreline.net

     电话:0756-2623870 2623871   客户服务:星期一到星期天7*24
     
     QQ咨询:168075865   188092185
-

回复列表 (共1个回复)

沙发

老大动点脑子好不好,首页上的调查也说明了来这里的客户群定位是青少年,他们还在长身体,谁没事租虚拟主机阿?

我来回复

您尚未登录,请登录后再回复。点此登录或注册