MySql Exeception was unhandled by user code

Aug 17 2015 8:22 AM
Hi,
 
Iam working on  mysql stored procedures tables   invoking it into C# but iam getting some errors.what i made mistake in this  will you please help me..
 
 Here is the code i using:
 
protected void Button1_Click(object sender, EventArgs e)
{
MySql.Data.MySqlClient.MySqlConnection msqlConnection = new MySql.Data.MySqlClient.MySqlConnection("server=localhost; user id=root;password=minnu123;database=world;persist security info=false");
//open the connection
if (msqlConnection.State != System.Data.ConnectionState.Open)
msqlConnection.Open();
//define the command reference
MySql.Data.MySqlClient.MySqlCommand msqlcommand = new MySql.Data.MySqlClient.MySqlCommand();
//define the connection used by the command object
msqlcommand.Connection = msqlConnection;
//define the command text
msqlcommand.CommandText = "insert into magazine('OrderId', 'PackageId', 'Status', 'GiftGiverName','Receipent FirstName','Receipent LastName','Receipent Gender','SpecialOccassionDescription','Title','CoverPhoto','DeliveryDate','Guid','MessageToContributors','CreatedOn')" + "values(@OrderId,@PackageId,@Status,@GiftGiverName,@GiftGiverEmail,@Receipent FirstName, @Receipent LastName, @Receipent Gender, @SpecialOccassionDescription, @Title, @CoverPhoto,@DeliveryDate,@Guid,@MessageToContributors,@CreatedOn)";
//add values provided by user
msqlcommand.Parameters.AddWithValue("@OrderId", TextBox1.Text);
msqlcommand.Parameters.AddWithValue("@PackageId", TextBox2.Text);
msqlcommand.Parameters.AddWithValue("@Status", TextBox3.Text);
msqlcommand.Parameters.AddWithValue("@GiftGiverName", TextBox4.Text);
msqlcommand.Parameters.AddWithValue("@GiftGiverEmail", TextBox5.Text);
msqlcommand.Parameters.AddWithValue("@ReceipentFirstName", TextBox6.Text);
msqlcommand.Parameters.AddWithValue("@ReceipentLastName", TextBox7.Text);
msqlcommand.Parameters.AddWithValue("@ReceipentGender", TextBox8.Text);
msqlcommand.Parameters.AddWithValue("@SpecialOccassionDescription", TextBox9.Text);
msqlcommand.Parameters.AddWithValue("@Title", TextBox10.Text);
msqlcommand.Parameters.AddWithValue("@CoverPhoto", TextBox11.Text);
msqlcommand.Parameters.AddWithValue("@DeliveryDate", TextBox12.Text);
msqlcommand.Parameters.AddWithValue("@Guid", TextBox13.Text);
msqlcommand.Parameters.AddWithValue("@MessageToContributors", TextBox14.Text);
msqlcommand.Parameters.AddWithValue("@CreatedOn", TextBox15.Text);
msqlcommand.ExecuteNonQuery();
//close the connection
msqlConnection.Close();
 
 }
 
 
 
Iam getting this error: 
 
An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll but was not handled in user code
Additional information: Fatal error encountered during command execution.
 

Answers (1)