MySQL & ByteFX (Invalid PInvoke metadata format)

MySQL & ByteFX (Invalid PInvoke metadata format)

Post by Don Lope » Sun, 02 May 2004 03:49:26

I get this exception when I try to run open on the MySQLConnection
object. It goes like this:

System.TypeLoadException: Invalid PInvoke metadata format.
at System.Net.OSSOCK.gethostbyname(String host)
at System.Net.Dns.GetHostByName(String hostname)
at ByteFX.Data.Common.StreamCreator.GetStream(Int32 timeOut)
at ByteFX.Data.MySqlClient.Driver.Open(MySqlConnectionString settings)
--- End of inner exception stack trace ---
at ByteFX.Data.MySqlClient.Driver.Open()

Has anyone got ByteFX to open a connection successfully? Am I setting
something up wrong? Here's my code:

Public Class Form1
Inherits System.Windows.Forms.Form

Friend WithEvents ppConnection As
Friend WithEvents ppOrderAdapter As

Private Sub InitDB() ' This gets called right after the
IDE-generated InitializeComponent()
Dim ppOrderSelect As String = _
"SELECT <field1>, <field2> " & _
"FROM Orders;"
Dim ppConnectStr As String = _
"SERVER=localhost;" & _
"DATABASE=ProdPlan;" & _

ppConnection = New
ppOrderAdapter = New ByteFX.Data.MySqlClient.MySqlDataAdapter _
(ppOrderSelect, ppConnection)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Catch ex As Exception
End Try

End Sub
End Class

MySQL & ByteFX (Invalid PInvoke metadata format)

Post by Kuntal » Sat, 08 May 2004 15:10:14

I'm also getting the same problem. Tried lot of ways but with no success.

Let me know if any one has successfully used ByteFX to open connection with MySQL.

Thanks in Advance,
- K.K.

Sent via Fuzzy Software @
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...


MySQL & ByteFX (Invalid PInvoke metadata format)

Post by Kiran » Fri, 15 Apr 2005 20:04:56

hi All,

I tried using ByteFx -MySQL &.Net , Did find any problem please chec
the following code


private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here

private void LoadGrid()
//-- create a connection string
string cConnString;
cConnString = "Server=localhost;Database=Prdb;User ID=root;Password=";

//-- create a connection object and specify the conn string
MySqlConnection oConn = new MySqlConnection();
oConn.ConnectionString = cConnString;

//-- create a command object
MySqlCommand oCmd = new MySqlCommand();
oCmd.CommandText = "select * from product";
oCmd.Connection = oConn;

//-- create a data adapter
MySqlDataAdapter oAdapt = new ByteFX.Data.MySqlClient.MySqlDataAdapter();
oAdapt.SelectCommand = oCmd;

//-- load the data into a dataset
DataSet ds = new DataSet();
oAdapt.Fill(ds, "product");

//-- show the results in a grid
DataGrid1.DataSource = ds.Tables["product"].DefaultView;;


Here i created "prdb" database - product table with product i
,productname,product description,unit price.
and try to view in DataGrid.

Let me know , if you have any problem