Download presentation
Presentation is loading. Please wait.
1
.NET + SQL SERVER SQL Server +SP4
10
Dim cn As System.Data.SqlClient.SqlConnection
Dim cmd As System.Data.SqlClient.SqlCommand Dim da As System.Data.SqlClient.SqlDataAdapter ' 建立與SQL Server資料庫的連線 cn = New System.Data.SqlClient.SqlConnection("uid=nwd;pwd=nwd;database=Northwind;server= ") cmd = New System.Data.SqlClient.SqlCommand("select * from employees", cn) da = New System.Data.SqlClient.SqlDataAdapter(cmd) ‘ 加入新的資料表 Dim dt As System.Data.DataTable = New System.Data.DataTable("employees") da.Fill(dt) DataGrid1.DataSource = dt
11
.NET + SQL CE
12
Dim cmd As System.Data.SqlServerCE.SqlCeCommand
Dim cn As System.Data.SqlServerCe.SqlCeConnection Dim da As System.Data.SqlServerCe.SqlCeDataAdapter cn = New System.Data.SqlServerce.SqlCeConnection("Data Source=" & ApplicationLocation() & "\NorthwindDemo.sdf") cmd = New System.Data.SqlServerCE.SqlCeCommand("select * from Customers", cn) da = New System.Data.SqlServerCE.SqlCeDataAdapter(cmd) Dim dt As System.Data.DataTable = New System.Data.DataTable("Customers") da.Fill(dt) DataGrid1.DataSource = dt
13
Private Function ApplicationLocation() As String
ApplicationLocation = _ System.IO.Path.GetDirectoryName(Reflection.Assembly. _ GetExecutingAssembly().GetName().CodeBase.ToString()) End Function
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.