[Mono-dev] I had problem with mysql_connection
amru rosyada
arros.syada at gmail.com
Tue Feb 14 00:26:10 EST 2006
I try to run code from mono-project this the code :
using System;
using System.Data;
using MySql.Data.MySqlClient;
public class Test
{
public static void Main(string[] args)
{
string connectionString =
"Server=localhost;" +
"Database=APP_DB;" +
"User ID=amru;" +
"Password=amru;" +
"Pooling=false";
IDbConnection dbcon;
dbcon = new
<http://www.google.com/search?q=new+msdn.microsoft.com>
MySqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
// requires a table to be created named employee
// with columns firstname and lastname
// such as,
// CREATE TABLE employee (
// firstname varchar(32),
// lastname varchar(32));
string sql =
"SELECT firstname, lastname " +
"FROM employee";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
string FirstName = (string) reader["firstname"];
string LastName = (string) reader["lastname"];
Console.WriteLine("Name: " +
FirstName + " " + LastName);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
### But I have some problem, this is the problem output that I had run :
Unhandled Exception:System.Net.Socket Exception:The Socket is not connected
In<0x0008d>System.Net.Socket:Shutdown(SocketShutdown how)
In<0x00060>MySql.Data.Common.SocketStream:Read(System.Byte[]
buffer,Int32 offset,Int32 count)
In<0x00136>System.IO.BufferedStream:Read(System.Byte[] array,Int32
offset,Int32 count)
In<0x0002f>System.IO.BufferedStream:ReadByte()
In<0x00026>MySql.Data.MySqlClient.PacketReader:ReadHeader()
In<0x00060>MySql.Data.MySqlClient.PacketReader:OpenPacket()
In<0x0028e>MySql.Data.MySqlClient.NativeDriver:Open()
In<0x00027>MySql.Data.MySqlClient.Driver:Create(MySql.Data.MySqlClient.MySqlConnectionString
settings)
In<0x00078>MySql.Data.MySqlClient.MySqlConnection:Open
What I miss it Please help me (send me mail)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060214/5fc1b46f/attachment.html
More information about the Mono-devel-list
mailing list