日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
進(jìn)行檢索ADO.NET數(shù)據(jù)說明

以下代碼列表演示如何使用 ADO.NET 數(shù)據(jù)提供程序從數(shù)據(jù)庫(kù)中檢索數(shù)據(jù)。數(shù)據(jù)在一個(gè) DataReader 中返回。有關(guān)更多信息,請(qǐng)參見使用 DataReader 檢索數(shù)據(jù) (ADO.NET)。

成都創(chuàng)新互聯(lián)專注于臨朐企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站,成都商城網(wǎng)站開發(fā)。臨朐網(wǎng)站建設(shè)公司,為臨朐等地區(qū)提供建站服務(wù)。全流程按需網(wǎng)站策劃,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務(wù)

SqlClient
此示例中的代碼假定您可以連接到 Microsoft SQL Server 7.0 或更高版本上的 Northwind 示例數(shù)據(jù)庫(kù)。ADO.NET 數(shù)據(jù)在此情形 5 中,示例代碼創(chuàng)建一個(gè) SqlCommand 以從 Products 表中選擇行,并添加 SqlParameter 來將結(jié)果限制為其 UnitPrice 大于指定參數(shù)值的行。

SqlConnection 在 using 塊內(nèi)打開,這將確保在代碼退出時(shí)會(huì)關(guān)閉和釋放資源。示例代碼使用 SqlDataReader 執(zhí)行命令,ADO.NET 數(shù)據(jù)并在控制臺(tái)窗口中顯示結(jié)果。此示例中的代碼假定您可以連接到 Microsoft Access Northwind 示例數(shù)據(jù)庫(kù)。#t#

在此情形 5 中,示例代碼創(chuàng)建一個(gè)ADO.NET 數(shù)據(jù) OleDbCommand 以從 Products 表中選擇行,并添加 OleDbParameter 來將結(jié)果限制為其 UnitPrice 大于指定參數(shù)值的行。OleDbConnection 在 using 塊內(nèi)打開,這將確保在代碼退出時(shí)會(huì)關(guān)閉和釋放資源。示例代碼使用 OleDbDataReader 執(zhí)行命令,并在控制臺(tái)窗口中顯示結(jié)果。

 
 
  1. Option Explicit On  
  2. Option Strict On  
  3.  
  4. Imports System  
  5. Imports System.Data  
  6. Imports System.Data.SqlClient  
  7.  
  8. Public Class Program  
  9. Public Shared Sub Main()  
  10.  
  11. Dim connectionString As String = GetConnectionString()  
  12. Dim queryString As String = _ 
  13.  "SELECT CategoryID, CategoryName FROM dbo.Categories;"  
  14.  
  15. Using connection As New SqlConnection(connectionString)  
  16. Dim command As SqlCommand = connection.CreateCommand()  
  17. command.CommandText = queryString 
  18. Try  
  19. connection.Open()  
  20. Dim dataReader As SqlDataReader = _ 
  21.  command.ExecuteReader()  
  22. Do While dataReader.Read()  
  23. Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", _  
  24.  dataReader(0), dataReader(1))  
  25. Loop  
  26. dataReader.Close()  
  27.  
  28. Catch ex As Exception  
  29. Console.WriteLine(ex.Message)  
  30. End Try  
  31. End Using  
  32. End Sub  
  33.  
  34. Private Shared Function GetConnectionString() As String  
  35. ' To avoid storing the connection string in your code,  
  36. ' you can retrieve it from a configuration file.  
  37. Return "Data Source=(local);Initial Catalog=Northwind;" _  
  38.  & "Integrated Security=SSPI;"  
  39. End Function  
  40. End Class 

文章題目:進(jìn)行檢索ADO.NET數(shù)據(jù)說明
網(wǎng)頁(yè)鏈接:http://www.5511xx.com/article/cdhpjsp.html