FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-18-2008, 12:47 AM
"Star Liu"
 
Default could anyone connect to mysql-server by mono(C#) on debian?

I got a strange error when i connect to mysql-server by mono(C#),
little information can be got on google, and no one answers me on the
mono mail lists, so i try to ask here, here is my code:

Here is the code, it compiles successfully

using System;
using System.IO;
using System.Xml;
using System.Data;
using MySql.Data.MySqlClient;


namespace StarConsole
{
class MainClass
{
public static void Main(string[] args)
{
string connectionString ="Server=localhost;Database=Star;User
ID=root;Password=password;Pooling=false";
IDbConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string sql ="insert into Departments(deptno,deptname)
values('0004','caohejin');";
dbcmd.CommandText = sql;
dbcmd.ExecuteNonQuery();
reader.Close();
reader = null;*/
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;

}
}
}

here is the debug information output by monodevelop when i run it:


Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.ArgumentException: Stream is not a valid .resources file,
magic=0x6d783f3c
at System.Resources.ResourceReader.ReadHeaders () [0x00000]
at System.Resources.ResourceReader..ctor (System.IO.Stream stream) [0x00000]
at System.Resources.ResourceSet..ctor (System.IO.Stream stream) [0x00000]
at (wrapper managed-to-native)
System.Reflection.MonoCMethod:InternalInvoke (object,object[])
at System.Reflection.MonoCMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000] --- End of inner exception stack trace ---

at System.Reflection.MonoCMethod.Invoke (System.Object obj,
BindingFlags invokeAttr, System.Reflection.Binder binder,
System.Object[] parameters, System.Globalization.CultureInfo culture)
[0x00000]
at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x00000]
at System.Activator.CreateInstance (System.Type type, BindingFlags
bindingAttr, System.Reflection.Binder binder, System.Object[] args,
System.Globalization.CultureInfo culture, System.Object[]
activationAttributes) [0x00000]
at System.Activator.CreateInstance (System.Type type,
System.Object[] args, System.Object[] activationAttributes) [0x00000]
at System.Activator.CreateInstance (System.Type type,
System.Object[] args) [0x00000]
at System.Resources.ResourceManager.InternalGetResour ceSet
(System.Globalization.CultureInfo culture, Boolean Createifnotexists,
Boolean tryParents) [0x00000]
at System.Resources.ResourceManager.GetString (System.String name,
System.Globalization.CultureInfo culture) [0x00000]
at MySql.Data.MySqlClient.Resources.get_PerfMonCatego ryName () [0x00000]
at MySql.Data.MySqlClient.PerformanceMonitor..ctor
(MySql.Data.MySqlClient.MySqlConnection connection) [0x00000]
at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]
at StarConsole.MainClass.Main (System.String[] args) [0x0000d] in
/root/Life/Mono/StarConsole/Main.cs:31

any suggestions? thanks!

--
Regards!
Star
Shanghai, China


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-19-2008, 07:53 AM
"Star Liu"
 
Default could anyone connect to mysql-server by mono(C#) on debian?

Finally, I use postgresql instead of mysql, and mono c# can work with
postgresql successfully.
so there is some bugs in libmysql5.0-cil package.

On Fri, Jul 18, 2008 at 8:47 AM, Star Liu <minxinjianxin@gmail.com> wrote:
> I got a strange error when i connect to mysql-server by mono(C#),
> little information can be got on google, and no one answers me on the
> mono mail lists, so i try to ask here, here is my code:
>
> Here is the code, it compiles successfully
>
> using System;
> using System.IO;
> using System.Xml;
> using System.Data;
> using MySql.Data.MySqlClient;
>
>
> namespace StarConsole
> {
> class MainClass
> {
> public static void Main(string[] args)
> {
> string connectionString ="Server=localhost;Database=Star;User
> ID=root;Password=password;Pooling=false";
> IDbConnection dbcon = new MySqlConnection(connectionString);
> dbcon.Open();
> IDbCommand dbcmd = dbcon.CreateCommand();
> string sql ="insert into Departments(deptno,deptname)
> values('0004','caohejin');";
> dbcmd.CommandText = sql;
> dbcmd.ExecuteNonQuery();
> reader.Close();
> reader = null;*/
> dbcmd.Dispose();
> dbcmd = null;
> dbcon.Close();
> dbcon = null;
>
> }
> }
> }
>
> here is the debug information output by monodevelop when i run it:
>
>
> Unhandled Exception: System.Reflection.TargetInvocationException:
> Exception has been thrown by the target of an invocation. --->
> System.ArgumentException: Stream is not a valid .resources file,
> magic=0x6d783f3c
> at System.Resources.ResourceReader.ReadHeaders () [0x00000]
> at System.Resources.ResourceReader..ctor (System.IO.Stream stream) [0x00000]
> at System.Resources.ResourceSet..ctor (System.IO.Stream stream) [0x00000]
> at (wrapper managed-to-native)
> System.Reflection.MonoCMethod:InternalInvoke (object,object[])
> at System.Reflection.MonoCMethod.Invoke (System.Object obj,
> BindingFlags invokeAttr, System.Reflection.Binder binder,
> System.Object[] parameters, System.Globalization.CultureInfo culture)
> [0x00000] --- End of inner exception stack trace ---
>
> at System.Reflection.MonoCMethod.Invoke (System.Object obj,
> BindingFlags invokeAttr, System.Reflection.Binder binder,
> System.Object[] parameters, System.Globalization.CultureInfo culture)
> [0x00000]
> at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
> System.Reflection.Binder binder, System.Object[] parameters,
> System.Globalization.CultureInfo culture) [0x00000]
> at System.Activator.CreateInstance (System.Type type, BindingFlags
> bindingAttr, System.Reflection.Binder binder, System.Object[] args,
> System.Globalization.CultureInfo culture, System.Object[]
> activationAttributes) [0x00000]
> at System.Activator.CreateInstance (System.Type type,
> System.Object[] args, System.Object[] activationAttributes) [0x00000]
> at System.Activator.CreateInstance (System.Type type,
> System.Object[] args) [0x00000]
> at System.Resources.ResourceManager.InternalGetResour ceSet
> (System.Globalization.CultureInfo culture, Boolean Createifnotexists,
> Boolean tryParents) [0x00000]
> at System.Resources.ResourceManager.GetString (System.String name,
> System.Globalization.CultureInfo culture) [0x00000]
> at MySql.Data.MySqlClient.Resources.get_PerfMonCatego ryName () [0x00000]
> at MySql.Data.MySqlClient.PerformanceMonitor..ctor
> (MySql.Data.MySqlClient.MySqlConnection connection) [0x00000]
> at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000]
> at StarConsole.MainClass.Main (System.String[] args) [0x0000d] in
> /root/Life/Mono/StarConsole/Main.cs:31
>
> any suggestions? thanks!
>
> --
> Regards!
> Star
> Shanghai, China
>



--
Regards!
Star
Shanghai, China


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 11:53 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org