Vb.net .NET 2012连接到Firebird数据库
我在使用VB.NET 2012连接Firebird数据库时遇到问题。我通过NuGet包管理器下载了Firebird实体框架提供程序 我进行了检查,项目中添加了以下参考: EntityFramework、EntityFramework.Firebird、EntityFramework.SqlServer和FirebirdSql.Data.FirebirdClient 运行程序时,输出窗口显示以下内容:Vb.net .NET 2012连接到Firebird数据库,vb.net,firebird,Vb.net,Firebird,我在使用VB.NET 2012连接Firebird数据库时遇到问题。我通过NuGet包管理器下载了Firebird实体框架提供程序 我进行了检查,项目中添加了以下参考: EntityFramework、EntityFramework.Firebird、EntityFramework.SqlServer和FirebirdSql.Data.FirebirdClient 运行程序时,输出窗口显示以下内容: A first chance exception of type 'System.Net.Soc
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'FirebirdSql.Data.Common.IscException' occurred in FirebirdSql.Data.FirebirdClient.dll
A first chance exception of type 'FirebirdSql.Data.FirebirdClient.FbException' occurred in FirebirdSql.Data.FirebirdClient.dll
A first chance exception of type 'FirebirdSql.Data.FirebirdClient.FbException' occurred in FirebirdSql.Data.FirebirdClient.dll
我没有在应用程序中显示任何错误,但什么也没有发生
这是我的密码:
Imports FirebirdSql.Data.FirebirdClient
Imports System.Text
Imports System.Net
Public Class Form1
Dim con As FbConnection
Dim cs As FbConnectionStringBuilder
Public Sub New()
InitializeComponent()
cs = New FbConnectionStringBuilder
cs.Database = "C:\database.fdb"
cs.ServerType = FbServerType.Default
cs.UserID = "SYSDBA"
cs.Password = "password"
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
con = New FbConnection(cs.ToString)
con.Open()
Dim sCmd As FbCommand
Dim sql As String
Dim ds As FbDataReader
sql = "SELECT something FROM TABLE"
sCmd = New FbCommand()
sCmd.Connection = con
sCmd.CommandText = sql
ds = sCmd.ExecuteReader
Dim str As New StringBuilder
While (ds.Read)
MsgBox(ds.GetString(0))
End While
ds.Close()
End
End Sub
End Class
我尝试过运行各种版本的Firebird,但我确实需要一些帮助。您的连接字符串缺少Firebird运行的主机名。答案很简单。因为我使用的是Firebird客户端,所以ServerType应该设置为Embedded,因为它包含一个特殊的客户端库,其中包含服务器本身。对此不确定,但我建议将该数据库从系统磁盘的根目录移走。通常,此路径需要最高级的写入权限,并且数据库提供程序需要对数据库的写入权限。您需要提供实际的异常堆栈跟踪。不,这是不正确的,因为我在另一个Windows框上使用了相同的代码。查看您自己的答案,您应该告诉我们您使用的是嵌入式,显然,您不需要主机名,我说过我使用的是Firebird实体框架提供程序,它只使用嵌入式。