Click here to Skip to main content
15,502,868 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# - managing JSON serialisation Pin
DerekT-P21-Mar-22 8:26
professionalDerekT-P21-Mar-22 8:26 
AnswerRe: C# - managing JSON serialisation Pin
Eddy Vluggen21-Mar-22 8:02
professionalEddy Vluggen21-Mar-22 8:02 
GeneralRe: C# - managing JSON serialisation Pin
DerekT-P21-Mar-22 8:34
professionalDerekT-P21-Mar-22 8:34 
QuestionRe: C# - managing JSON serialisation Pin
Eddy Vluggen21-Mar-22 13:26
professionalEddy Vluggen21-Mar-22 13:26 
QuestionNeed C# and Mysql Tutorial Pin
N Mohamed rafi20-Mar-22 19:13
N Mohamed rafi20-Mar-22 19:13 
AnswerRe: Need C# and Mysql Tutorial Pin
OriginalGriff20-Mar-22 21:43
mveOriginalGriff20-Mar-22 21:43 
AnswerRe: Need C# and Mysql Tutorial Pin
RobertSF21-Mar-22 11:29
professionalRobertSF21-Mar-22 11:29 
GeneralMysql Update Query Error Pin
N Mohamed rafi20-Mar-22 6:25
N Mohamed rafi20-Mar-22 6:25 
It shows record updated successfully but not updating in database

private void button13_Click(object sender, EventArgs e)
{
if (textBox6.Text != "" && textBox7.Text != "" && textBox8.Text != "")
{
string connectionString;
MySqlConnection cnn;
connectionString = @"Data Source=localhost;Initial Catalog=testDB;User ID=root;Password=mysql";
cnn = new MySqlConnection(connectionString);
//string id = Convert.ToInt32(textBox6.Text);
string id = textBox6.Text;
string name = textBox7.Text;
string salary = textBox8.Text;
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
string query = "update employee set employee_id='" + this.textBox6.Text + "',employee_name='" + this.textBox7.Text + "',employee_salary='" + this.textBox8.Text + "' where employee_id='" + this.textBox6.Text + "';";
using (MySqlCommand cmd = new MySqlCommand(query))
{
cmd.Parameters.AddWithValue("@employee_id", id);
cmd.Parameters.AddWithValue("@employee_name", name);
cmd.Parameters.AddWithValue("@employee_salary", salary);
cmd.Connection = cnn;
cnn.Open();
cmd.ExecuteNonQuery();
DialogResult dr = MessageBox.Show("Are you sure to update row?", "Confirmation", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
MessageBox.Show("Record Updated Successfully");
cnn.Close();
DisplayData();
ClearData();
}
else if (dr == DialogResult.No)
{
MessageBox.Show("Dude, We keep this record as same");
}

}
}
else
{
MessageBox.Show("Please Select Record to Update");
}
}

modified 20-Mar-22 11:58am.

GeneralRe: Mysql Update Query Error Pin
Victor Nijegorodov20-Mar-22 8:47
Victor Nijegorodov20-Mar-22 8:47 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 9:44
N Mohamed rafi20-Mar-22 9:44 
SuggestionRe: Mysql Update Query Error Pin
Eddy Vluggen20-Mar-22 9:40
professionalEddy Vluggen20-Mar-22 9:40 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 9:45
N Mohamed rafi20-Mar-22 9:45 
GeneralRe: Mysql Update Query Error Pin
OriginalGriff20-Mar-22 9:47
mveOriginalGriff20-Mar-22 9:47 
GeneralRe: Mysql Update Query Error Pin
Eddy Vluggen20-Mar-22 10:43
professionalEddy Vluggen20-Mar-22 10:43 
GeneralRe: Mysql Update Query Error Pin
OriginalGriff20-Mar-22 10:46
mveOriginalGriff20-Mar-22 10:46 
GeneralRe: Mysql Update Query Error Pin
Eddy Vluggen21-Mar-22 8:06
professionalEddy Vluggen21-Mar-22 8:06 
GeneralRe: Mysql Update Query Error Pin
OriginalGriff21-Mar-22 8:34
mveOriginalGriff21-Mar-22 8:34 
GeneralRe: Mysql Update Query Error Pin
Dave Kreskowiak20-Mar-22 11:49
mveDave Kreskowiak20-Mar-22 11:49 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 19:09
N Mohamed rafi20-Mar-22 19:09 
GeneralRe: Mysql Update Query Error Pin
Richard MacCutchan20-Mar-22 23:25
mveRichard MacCutchan20-Mar-22 23:25 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi21-Mar-22 0:45
N Mohamed rafi21-Mar-22 0:45 
GeneralRe: Mysql Update Query Error Pin
Richard MacCutchan21-Mar-22 0:50
mveRichard MacCutchan21-Mar-22 0:50 
GeneralRe: Mysql Update Query Error Pin
Dave Kreskowiak21-Mar-22 3:29
mveDave Kreskowiak21-Mar-22 3:29 
Generalmysql delete code error Pin
N Mohamed rafi19-Mar-22 17:36
N Mohamed rafi19-Mar-22 17:36 
GeneralRe: mysql delete code error Pin
Dave Kreskowiak19-Mar-22 18:54
mveDave Kreskowiak19-Mar-22 18:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.