ASP.NET连SQL7接口的源代码
The following example shows what a simple 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 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
Imports lient
Imports alBasic
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 = teCommand()
mandText = "SELECT CategoryID, CategoryName FROM Categories"
()
Dim myReader As SqlDataReader = uteReader()
Do While ()
eLine(vbTab & "{0}" & vbTab & "{1}", nt32(0), tring(1))
Loop
e()
e()
End Sub
End Class
[C#]
using System;
using ;
using lient;
class Sample
{
public static void Main()
{
SqlConnection nwindConn = new SqlConnection("Data Source=localhost;User Id=sa;Password=pwd;Initial Catalog=northwind");
SqlCommand catCMD = teCommand();
mandText = "SELECT CategoryID, CategoryName FROM Categories";
();
SqlDataReader myReader = uteReader();
while (())
{
eLine("t{0}t{1}", nt32(0), tring(1));
}
e();
e();
}
}
OleDb
[Visual Basic]
Imports System
Imports
Imports b
Imports alBasic
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 = teCommand()
mandText = "SELECT CategoryID, CategoryName FROM Categories"
()
Dim myReader As OleDbDataReader = uteReader()
Do While ()
eLine(vbTab & "{0}" & vbTab & "{1}", nt32(0), tring(1))
Loop
e()
e()
End Sub
End Class
[C#]
using System;
using ;
using b;
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 = teCommand();
mandText = "SELECT CategoryID, CategoryName FROM Categories";
();
OleDbDataReader myReader = uteReader();
while (())
{
eLine("t{0}t{1}", nt32(0), tring(1));
}
e();
e();
}
}
-
卧室怎么设计才好看
卧室作为人们修身养息的重要场所,在装修设计的时候,并不是随个人喜好决定的,而是以舒适为主。舒适可以说是卧室设计的最基本的原则。而这种舒适感,首先表现为实用性,然后才是装饰性。这里的实用性包括休息舒适、收纳强大、家具摆放合理,而装饰性则包括了卧室的色调搭...
-
如何用Word软件制作常用公文
说到办公文秘这个课程,大家都会想到Word这个文档,那么对于这个Word软件,你是否已经很深入的了解了呢?而且,如何用Word软件来制作常用公文。我们一起来看看吧~第一步,进入Word界面第二步,页面设置从文件栏中单击页面设置,弹出选项,在页边距栏中选择上:37mm;下:35mm;左:28mm...
-
2017计算机应用基础考试选择题「附答案」
一、选择题1、使用(B)可以帮助用户释放硬盘驱动器空间,删除临时文件、Intemet缓存文件和可以安全删除不需要的文件,腾出它们占用的系统资源,以提高系统性能。A、格式化;B、磁盘清理程序;C、整理磁盘碎片;D、磁盘查错。2、格式化硬盘可分为(A)和(B)。A、高级格式化...
-
公文拟办意见怎么提?
公文办理是机关办公部门的一项重要工作,批办性公文的办理则是公文办理工作的重中之重。写好拟办意见,是批办性公文办理的关键环节和难点所在。怎样才能提好拟办意见?在多年的公文办理实践中,我们从“五个结合”着手,收到了较好效果。1结合来文背景、要求掌握来文内...