本文整理汇总了VB.NET中System.Data.OleDb.OleDbConnection.Database属性的典型用法代码示例。如果您正苦于以下问题:VB.NET OleDbConnection.Database属性的具体用法?VB.NET OleDbConnection.Database怎么用?VB.NET OleDbConnection.Database使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Data.OleDb.OleDbConnection
的用法示例。
在下文中一共展示了OleDbConnection.Database属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: OpenConnection
Public Sub OpenConnection(ByVal connectionString As String)
Using connection As New OleDbConnection(connectionString)
Try
connection.Open()
Console.WriteLine("Server Version: {0} Database: {1}", _
connection.ServerVersion, connection.Database)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
' The connection is automatically closed when the
' code exits the Using block.
End Using
End Sub
示例2: MainClass
' 导入命名空间
Imports System
Imports System.Data
Imports System.Data.OleDb
public class MainClass
Shared Sub Main()
Dim connString As String = "provider= microsoft.jet.oledb.4.0;data source=Employee.mdb;"
Dim conn As New OleDbConnection(connString)
Try
conn.Open()
Console.WriteLine("- ConnectionString : {0}", conn.ConnectionString)
Console.WriteLine("- Database : {0}",conn.Database)
Console.WriteLine("- DataSource : {0}",conn.DataSource)
Console.WriteLine("- ServerVersion : {0}",conn.ServerVersion)
Console.WriteLine("- State : {0}", conn.State)
Catch ex As OleDbException
Console.WriteLine("Error: " & ex.ToString())
Finally
conn.Close()
Console.WriteLine("Connection Closed")
End Try
End Sub
End Class