Problem with MySqlClient.MySqlException: #42000
Posted by:
Wilbert Ortega ()
Date: May 25, 2005 07:07PM
Hi:
I have one problem:
MySqlClient.MySqlException: #42000 You have an error in your SQL sintax; checks the manual thats corresponds to your MySQL Server version for the right syntax to use near "" at line 1 ....
.......
......
My source code is:
string strConexion= "Database=Mande;Data Source=localhost;User Id=root;Password=12345.00";
MySqlConnection objConexion=new MySqlConnection(strConexion);
MySqlCommand objConsulta=new MySqlCommand("INSERT INTO Table1 VALUES ("+ item1.Text +",'"+ item2.Text +"',"+ item3.Text +",#"+ item4.Text +"#) ");
try
{
objConexion.Open();
objConsulta.Connection=objConexion;
objConsulta.Transaction=objConexion.BeginTransaction(IsolationLevel.ReadCommitted);
tAct.CommandText="";
tAct.ExecuteNonQuery();
}
catch(Exception error)
{
objConsulta.Dispose();
objConexion.Close();
MessageBox.Show("Ha surgido un error: "+error.ToString(),"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
The problem start when I debug the line: tAct.ExecuteNonQuery();
I hope thats you help me...thanks!
I use to MySQL Server 4.1.12-nt via TCP/IP and MySQL Client Version 5.0.0, both installed on Windows 2000 Professional