MySQL Forums
Forum List  »  MySQL for Visual Studio

Re: SQL Connection Error
Posted by: Luis Penunuri
Date: May 12, 2016 03:09PM

Hi Joshua,

Thanks for using MySQL as your Database provider and for writing in our forums.

I set up a fresh MySQL Server 5.7.12, using the my.ini file you provided before, and was able to "select" and "insert" data into a table successfully, using a connection string like yours:

<add name="constr" connectionString="Server=127.0.0.1;Port=3306;Database=test;Uid=root;Pwd=****;" />
.
.
.
protected void Button1_Click(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (MySqlConnection con = new MySqlConnection(constr))
{
using (MySqlCommand cmd = new MySqlCommand("insert into table1 values (3, 'test3');"))
{
con.Open();
cmd.Connection = con;
cmd.ExecuteNonQuery();
con.Close();
}
}
}

Can you please provide more information (the inner exception, stack trace, etc.) about the error you are getting when executing an insert command ?

That would be very helpful for us in order to try to get the root cause of the error you are getting.

Thanks in advance, and have a good one !

Options: ReplyQuote


Subject
Views
Written By
Posted
1063
April 27, 2016 02:46PM
529
April 29, 2016 01:10PM
Re: SQL Connection Error
603
May 12, 2016 03:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.