Za ODBC s Firebird
5 отговора
152 прегледа
Za ODBC s Firebird
Имам драйвер за ODBC Firebird обаче нещо не успях да намеря начин да го използвам с .Нет и изобщо не можах да намеря нищо за ODBC в хелпа освен за Visual C++. Някой да знае нещо по въпроса
Re: Za ODBC s Firebird
Като го инсталираш драйвер-а отиваш във VisualStudio и си добавяш референс към асемблито. Там където искаш да го ползваш си инклудваш неймспейса и си бачкаш нормално.
Повече инфо има
тук
Може да четеш на firebird.sourceforge.net
Повече инфо има
тук
Може да четеш на firebird.sourceforge.net
Редактирано от AzSumZmei на
Re: Za ODBC s Firebird
Joro,ODBC Firebird Data Provider-a se izpolzva po sy6tiq na4in kakto i .NET Firebird Data Provider-a,kakto i vsi4ki komponenti prinadlija6ti kym driver-a. 
Re: Za ODBC s Firebird
Ползвам кода Imports FirebirdSql.Data.Firebird
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim frb As New FbCommand(), ConStr As String, cs As New FbConnectionStringBuilder()
Dim transaction As FbTransaction
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
Me.ClientSize = New System.Drawing.Size(520, 312)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cs.DataSource = "localhost"
cs.Database = "D:\\S\\lizing-new.cit"
cs.UserID = "SYSDBA"
cs.Password = "masterkey"
cs.Dialect = 3
cs.Port = 3050
ConStr = cs.ToString
frb.Connection = New FbConnection(ConStr)
frb.CommandText = "Select T_Nomenk_109.* from T_Nomenk_109"
Try
frb.Connection.Open()
transaction = frb.Connection.BeginTransaction
transaction.Commit()
frb.Connection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
и ми дава следната грешка: System.TypeLoadException: Invalid PInvoke metadata format.
at System.Net.OSSOCK.gethostbyname(String host)
at System.Net.Dns.GetHostByName(String hostName)
at System.Net.Dns.Resolve(String hostName)
at FirebirdSql.Data.Gds.GdsConnection.Connect(String dataSource, Int32 port, Int32 packetSize, Charset charset)
at FirebirdSql.Data.Gds.GdsDatabase.Attach(DatabaseParameterBuffer dpb, String dataSource, Int32 port, String database)
at FirebirdSql.Data.Firebird.FbConnectionInternal.Connect()
at FirebirdSql.Data.Firebird.FbConnectionPool.Create()
at FirebirdSql.Data.Firebird.FbConnectionPool.CheckOut()
at FirebirdSql.Data.Firebird.FbConnection.Open()
at Firebird.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\amc-info.AVTOMOTOR\My Documents\Visual Studio Projects\Firebird\Form1.vb:line 75
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim frb As New FbCommand(), ConStr As String, cs As New FbConnectionStringBuilder()
Dim transaction As FbTransaction
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
Me.ClientSize = New System.Drawing.Size(520, 312)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cs.DataSource = "localhost"
cs.Database = "D:\\S\\lizing-new.cit"
cs.UserID = "SYSDBA"
cs.Password = "masterkey"
cs.Dialect = 3
cs.Port = 3050
ConStr = cs.ToString
frb.Connection = New FbConnection(ConStr)
frb.CommandText = "Select T_Nomenk_109.* from T_Nomenk_109"
Try
frb.Connection.Open()
transaction = frb.Connection.BeginTransaction
transaction.Commit()
frb.Connection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
и ми дава следната грешка: System.TypeLoadException: Invalid PInvoke metadata format.
at System.Net.OSSOCK.gethostbyname(String host)
at System.Net.Dns.GetHostByName(String hostName)
at System.Net.Dns.Resolve(String hostName)
at FirebirdSql.Data.Gds.GdsConnection.Connect(String dataSource, Int32 port, Int32 packetSize, Charset charset)
at FirebirdSql.Data.Gds.GdsDatabase.Attach(DatabaseParameterBuffer dpb, String dataSource, Int32 port, String database)
at FirebirdSql.Data.Firebird.FbConnectionInternal.Connect()
at FirebirdSql.Data.Firebird.FbConnectionPool.Create()
at FirebirdSql.Data.Firebird.FbConnectionPool.CheckOut()
at FirebirdSql.Data.Firebird.FbConnection.Open()
at Firebird.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\amc-info.AVTOMOTOR\My Documents\Visual Studio Projects\Firebird\Form1.vb:line 75
Re: Za ODBC s Firebird
Хванах проблема. Оказа се, че съм ползвал по-новия драйвер със ВС 2002