Page 1 of 1

Visual Studio Compile time error...

Posted: Thu 16 Dec 2010 16:59
by evaughen
I am testing devart.data.mySQL under Visual Studio C# 2010 Express and am testing the "INSERT" SQL command. However when I try to execute the insert using the "cmd.ExecuteNonQuery()", Visual studio complains upon attempting to compile...

"Error 2 'Devart.Data.MySql.MySqlCommand' does not contain a definition for 'ExecuteNonQuery' and no extension method 'ExecuteNonQuery' accepting a first argument of type 'Devart.Data.MySql.MySqlCommand' could be found (are you missing a using directive or an assembly reference?)"

CODE:

...

using Devart.Data.MySql;

...

MySqlCommand cmd = new MySqlCommand();
cmd.Connection = myConnection;

cmd.CommandText = "insert into APPL (APPID,DescLong,DescShort,ImageFileID,Active) VALUES ('Test','Test Long Descrp','Test Short Descript','test.jpg','Y')";

try
{
int aff = cmd.ExecuteNonQuery();
MessageBox.Show(aff + " rows were affected.");
}
finally
{
myConnection.Close();
}

...

Posted: Thu 16 Dec 2010 18:15
by evaughen
Ahhhh, I needed to "Add Reference" to both "Devart.Data" and "Devart.Data.MySql" in my project.