Visual Studio Compile time error...

Visual Studio Compile time error...

Postby evaughen » Thu 16 Dec 2010 16:59

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();
}

...
evaughen
 
Posts: 5
Joined: Thu 16 Dec 2010 16:46

Postby evaughen » Thu 16 Dec 2010 18:15

Ahhhh, I needed to "Add Reference" to both "Devart.Data" and "Devart.Data.MySql" in my project.
evaughen
 
Posts: 5
Joined: Thu 16 Dec 2010 16:46


Return to dotConnect for MySQL