Click here to Skip to main content
15,347,735 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# - managing JSON serialisation Pin
DerekT-P21-Mar-22 7:26
professionalDerekT-P21-Mar-22 7:26 
AnswerRe: C# - managing JSON serialisation Pin
Eddy Vluggen21-Mar-22 7:02
professionalEddy Vluggen21-Mar-22 7:02 
GeneralRe: C# - managing JSON serialisation Pin
DerekT-P21-Mar-22 7:34
professionalDerekT-P21-Mar-22 7:34 
QuestionRe: C# - managing JSON serialisation Pin
Eddy Vluggen21-Mar-22 12:26
professionalEddy Vluggen21-Mar-22 12:26 
QuestionNeed C# and Mysql Tutorial Pin
N Mohamed rafi20-Mar-22 18:13
MemberN Mohamed rafi20-Mar-22 18:13 
AnswerRe: Need C# and Mysql Tutorial Pin
OriginalGriff20-Mar-22 20:43
mveOriginalGriff20-Mar-22 20:43 
AnswerRe: Need C# and Mysql Tutorial Pin
RobertSF21-Mar-22 10:29
professionalRobertSF21-Mar-22 10:29 
GeneralMysql Update Query Error Pin
N Mohamed rafi20-Mar-22 5:25
MemberN Mohamed rafi20-Mar-22 5: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 7:47
MemberVictor Nijegorodov20-Mar-22 7:47 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 8:44
MemberN Mohamed rafi20-Mar-22 8:44 
SuggestionRe: Mysql Update Query Error Pin
Eddy Vluggen20-Mar-22 8:40
professionalEddy Vluggen20-Mar-22 8:40 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 8:45
MemberN Mohamed rafi20-Mar-22 8:45 
GeneralRe: Mysql Update Query Error Pin
OriginalGriff20-Mar-22 8:47
mveOriginalGriff20-Mar-22 8:47 
GeneralRe: Mysql Update Query Error Pin
Eddy Vluggen20-Mar-22 9:43
professionalEddy Vluggen20-Mar-22 9:43 
GeneralRe: Mysql Update Query Error Pin
OriginalGriff20-Mar-22 9:46
mveOriginalGriff20-Mar-22 9:46 
GeneralRe: Mysql Update Query Error Pin
Eddy Vluggen21-Mar-22 7:06
professionalEddy Vluggen21-Mar-22 7:06 
GeneralRe: Mysql Update Query Error Pin
OriginalGriff21-Mar-22 7:34
mveOriginalGriff21-Mar-22 7:34 
GeneralRe: Mysql Update Query Error Pin
Dave Kreskowiak20-Mar-22 10:49
mveDave Kreskowiak20-Mar-22 10:49 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 18:09
MemberN Mohamed rafi20-Mar-22 18:09 
GeneralRe: Mysql Update Query Error Pin
Richard MacCutchan20-Mar-22 22:25
mveRichard MacCutchan20-Mar-22 22:25 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 23:45
MemberN Mohamed rafi20-Mar-22 23:45 
GeneralRe: Mysql Update Query Error Pin
Richard MacCutchan20-Mar-22 23:50
mveRichard MacCutchan20-Mar-22 23:50 
GeneralRe: Mysql Update Query Error Pin
Dave Kreskowiak21-Mar-22 2:29
mveDave Kreskowiak21-Mar-22 2:29 
Generalmysql delete code error Pin
N Mohamed rafi19-Mar-22 16:36
MemberN Mohamed rafi19-Mar-22 16:36 
GeneralRe: mysql delete code error Pin
Dave Kreskowiak19-Mar-22 17:54
mveDave Kreskowiak19-Mar-22 17: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.