本文整理汇总了VB.NET中System.Data.OleDb.OleDbDataAdapter.Fill方法的典型用法代码示例。如果您正苦于以下问题:VB.NET OleDbDataAdapter.Fill方法的具体用法?VB.NET OleDbDataAdapter.Fill怎么用?VB.NET OleDbDataAdapter.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbDataAdapter 的用法示例。
在下文中一共展示了OleDbDataAdapter.Fill方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: MainClass
' 导入命名空间
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Windows.Forms
Imports System.Resources
Public Class MainClass
Shared Sub Main()
Dim strConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Employee.mdb;"
Dim objConnection As New OleDbConnection(strConnectionString)
Dim strSQL As String = "SELECT FirstName, LastName FROM Employee"
Dim objCommand As New OleDbCommand(strSQL, objConnection)
Dim objDataAdapter As New OleDbDataAdapter(objCommand)
Dim objDataTable As New Data.DataTable("Employee")
Dim objDataRow As DataRow
Try
objConnection.Open()
objDataAdapter.Fill(objDataTable)
For Each objDataRow In objDataTable.Rows
Console.WriteLine(objDataRow.Item("FirstName") & " " & objDataRow.Item("LastName"))
Next
Catch OleDbExceptionErr As OleDbException
Console.WriteLine(OleDbExceptionErr.Message)
Catch InvalidOperationExceptionErr As InvalidOperationException
Console.WriteLine(InvalidOperationExceptionErr.Message)
End Try
objConnection.Close()
objDataRow = Nothing
objDataTable.Dispose()
objDataTable = Nothing
objDataAdapter.Dispose()
objDataAdapter = Nothing
objCommand.Dispose()
objCommand = Nothing
objConnection.Dispose()
objConnection = Nothing
End Sub
End Class
开发者ID:VB程序员,项目名称:System.Data.OleDb,代码行数:45,代码来源:OleDbDataAdapter.Fill
注:本文中的System.Data.OleDb.OleDbDataAdapter.Fill方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论