> Tony, can you post the code you are using to actually send the sql
to
the database? The problem is likely to be there. Also, please post
the code of the addShashes method so I can verify that
Thanks for the reply Jeffrey, heres the class I use for handling
connection to the database, it included the addslashes method
public class dbMysql
{
private OdbcConnection MyConnection;
public void connect(string MyConString)
{
MyConnection = new OdbcConnection(MyConString);
MyConnection.Open();
}
public string addSlashes(string query)
{
query = Regex.Replace(query,@"\\",@"\\");
query = Regex.Replace(query,"'","\\'");
query = Regex.Replace(query,"\"","\\\"");
return query;
}
public OdbcCommand getCommand()
{
OdbcCommand MyCommand = new OdbcCommand();
MyCommand.Connection = MyConnection;
return MyCommand;
}
public void close()
{
MyConnection.Close();
}
}
and the code that does the insert is simply
try
{
command.CommandText = query;
command.ExecuteNonQuery();
}
catch (OdbcException MyOdbcException)
{
Console.WriteLine("in exception");
for (int i=0; i < MyOdbcException.Errors.Count; i++)
{
MessageBox.Show("Message: " +
MyOdbcException.Errors[i].Message);
}
}
regards
tony