首页 >> 读书频道 >> 电脑 >> ASP.NET连SQL7接口源代码
 
· 通过地址栏传递参数.通过
· 用ADO STREAM做
· 利用XML不离开页面刷新
· 关于 aspsmartu
· ASP乱码的解决方法
· ASP向NT域中加一个用
· 用ASP实现从SQL S
· ASP中有关timeou
· 怎样写你自己的EMAIL
· 如何在主页中控制浏览权限
· 用ADO STREAM做
· 如何用asp把sqlse
 
· 美容养颜手册
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 武林寓言故事
· 2006高考录取规则
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

ASP.NET连SQL7接口源代码


查看有无更新版本

关键字:ASP技巧 2006-9-8

 

The following example shows what a simple ADO.NET application that connects to the Northwind database and returns a list of Categories would look like. The example writes the output to the console, or command prompt.
The following example shows what a simple ADO.NET application that connects to the Northwind database and returns a list of Categories. The example writes the output to the console, or command prompt.
SqlClient
[Visual Basic]
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Public Class Sample
  Public Shared Sub Main()
    Dim nwindConn As SqlConnection = New SqlConnection("Data Source=localhost;" & _
                                                       "User Id=sa;Password=pwd;Initial Catalog=northwind")
    Dim catCMD As SqlCommand = nwindConn.CreateCommand()
    catCMD.CommandText = "SELECT CategoryID, CategoryName FROM Categories"
    nwindConn.Open()
    Dim myReader As SqlDataReader = catCMD.ExecuteReader()
    Do While myReader.Read()
      Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
    Loop
    myReader.Close()
    nwindConn.Close()
  End Sub
End Class
[C#]
using System;
using System.Data;
using System.Data.SqlClient;
class Sample
{
  public static void Main()
  {
    SqlConnection nwindConn = new SqlConnection("Data Source=localhost;User Id=sa;Password=pwd;Initial Catalog=northwind");
    SqlCommand catCMD = nwindConn.CreateCommand();
    catCMD.CommandText = "SELECT CategoryID, CategoryName FROM Categories";
    nwindConn.Open();
    SqlDataReader myReader = catCMD.ExecuteReader();
    while (myReader.Read())
    {
      Console.WriteLine("\t{0}\t{1}", myReader.GetInt32(0), myReader.GetString(1));
    }
    myReader.Close();
    nwindConn.Close();
  }
}
OleDb
[Visual Basic]
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic
Public Class Sample
  Public Shared Sub Main()
    Dim nwindConn As OleDbConnection = New OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" & _
                                                           "User Id=sa;Password=pwd;Initial Catalog=northwind")
    Dim catCMD As OleDbCommand = nwindConn.CreateCommand()
    catCMD.CommandText = "SELECT CategoryID, CategoryName FROM Categories"
    nwindConn.Open()
    Dim myReader As OleDbDataReader = catCMD.ExecuteReader()
    Do While myReader.Read()
      Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
    Loop
    myReader.Close()
    nwindConn.Close()
  End Sub
End Class
[C#]
using System;
using System.Data;
using System.Data.OleDb;
class Sample
{
  public static void Main()
  {
    OleDbConnection nwindConn = new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;User Id=sa;Password=pwd;Initial Catalog=northwind");
    OleDbCommand catCMD = nwindConn.CreateCommand();
    catCMD.CommandText = "SELECT CategoryID, CategoryName FROM Categories";
    nwindConn.Open();
    OleDbDataReader myReader = catCMD.ExecuteReader();
    while (myReader.Read())
    {
      Console.WriteLine("\t{0}\t{1}", myReader.GetInt32(0), myReader.GetString(1));
    }
    myReader.Close();
    nwindConn.Close();
  }
}

ASP.NET连SQL7接口源代码

[ 1 ]
ASP.NET连SQL7接口源代码 num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑