Hi @Mohamed Rafi N Thank you for posting your Question on Microsoft Q&A and for using Azure services.
Sorry for the delay in response to your question.
If my understanding is correct, you are looking for a code for insert button and you would also like to write a connection string for your SQL workbench 8.0 using visual studio. Please let me know if my understanding is not correct.
I have tried to repo the issue successfully.
To create the form in visual studio please follow the step below
- Go to your visual studio
- click on create a new project
- once the page is open and type on the search as shown below
Once the page is created click on search text box then start drag and drop
How to write the connection string
int id = Convert.ToInt32(textBox1.Text);
string name = textBox2.Text;
double Salary = Convert.ToDouble(textBox3.Text);
string connectionString;
MySqlConnection cnn;
connectionString = "server=localhost;database=test;uid=root;pwd=password@123;";
cnn = new MySqlConnection(connectionString);
cnn.Open();
string insertQuery = "insert into test.Employee(employee_id,employee_name,employee_salary) values(" + id + ",'" + name + "'," + Salary + ")";
MySqlCommand cmd = new MySqlCommand(insertQuery,cnn);
MySqlDataReader rdr = cmd.ExecuteReader();
cnn.Close();
Like below
Please let me know if you are still having problems.
Regards,
Oury