Memory allocation error from MySql ODBC 5.1 driver in C# application on insert statement
Posted
by Chinjoo
on Stack Overflow
See other posts from Stack Overflow
or by Chinjoo
Published on 2010-06-05T17:10:58Z
Indexed on
2010/06/05
17:12 UTC
Read the original article
Hit count: 598
I have a .NET Wndows application in C#. It's a simple Windows application that is using the MySql 5.1 database community edition. I've downloaded the MySql ODBC driver and have created a dsn to my database on my local machine. On my application, I can perform get type queries without problems, but when I execute a given insert statement (not that I've tried doing any others), I get the following error:
{"ERROR [HY001] [MySQL][ODBC 5.1 Driver][mysqld-5.0.27-community-nt]Memory allocation error"}
I'm running on a Windows XP machine. My machine has 1 GB of memory. Anyone have any ideas? See code below
OdbcConnection MyConn = DBConnection.getDBConnection();
int result = -1;
try
{
MyConn.Open();
OdbcCommand myCmd = new OdbcCommand();
myCmd.Connection = MyConn;
myCmd.CommandType = CommandType.Text;
OdbcParameter userName = new OdbcParameter("@UserName", u.UserName);
OdbcParameter password = new OdbcParameter("@Password", u.Password);
OdbcParameter firstName = new OdbcParameter("@FirstName", u.FirstName);
OdbcParameter LastName = new OdbcParameter("@LastName", u.LastName);
OdbcParameter sex = new OdbcParameter("@sex", u.Sex);
myCmd.Parameters.Add(userName);
myCmd.Parameters.Add(password);
myCmd.Parameters.Add(firstName);
myCmd.Parameters.Add(LastName);
myCmd.Parameters.Add(sex);
myCmd.CommandText = mySqlQueries.insertChatUser;
result = myCmd.ExecuteNonQuery();
}
catch (Exception e)
{
//{"ERROR [HY001] [MySQL][ODBC 5.1 Driver][mysqld-5.0.27-community-nt]Memory
// allocation error"} EXCEPTION ALWAYS THROWN HERE
}
finally
{
try
{
if (MyConn != null) MyConn.Close();
}
finally { }
}
© Stack Overflow or respective owner