Click here to Skip to main content
15,891,253 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:26
N Mohamed rafi21-Mar-22 23:26 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan21-Mar-22 23:42
mveRichard MacCutchan21-Mar-22 23:42 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi21-Mar-22 23:49
N Mohamed rafi21-Mar-22 23:49 
GeneralRe: C# to Mysql Login code Error Pin
Richard MacCutchan21-Mar-22 23:55
mveRichard MacCutchan21-Mar-22 23:55 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:32
N Mohamed rafi22-Mar-22 1:32 
GeneralRe: C# to Mysql Login code Error Pin
Dave Kreskowiak22-Mar-22 1:43
mveDave Kreskowiak22-Mar-22 1:43 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:44
N Mohamed rafi22-Mar-22 1:44 
GeneralRe: C# to Mysql Login code Error Pin
Dave Kreskowiak22-Mar-22 1:45
mveDave Kreskowiak22-Mar-22 1:45 
GeneralRe: C# to Mysql Login code Error Pin
N Mohamed rafi22-Mar-22 1:46
N Mohamed rafi22-Mar-22 1:46 
GeneralRe: C# to Mysql Login code Error Pin
Dave Kreskowiak22-Mar-22 1:49
mveDave Kreskowiak22-Mar-22 1:49 
QuestionC# - managing JSON serialisation Pin
DerekT-P21-Mar-22 0:32
professionalDerekT-P21-Mar-22 0:32 
AnswerRe: C# - managing JSON serialisation Pin
Richard Deeming21-Mar-22 2:10
mveRichard Deeming21-Mar-22 2:10 
GeneralRe: C# - managing JSON serialisation Pin
DerekT-P21-Mar-22 3:21
professionalDerekT-P21-Mar-22 3:21 
GeneralRe: C# - managing JSON serialisation Pin
Richard Deeming21-Mar-22 3:28
mveRichard Deeming21-Mar-22 3:28 
AnswerRe: C# - managing JSON serialisation Pin
Gerry Schmitz21-Mar-22 4:59
mveGerry Schmitz21-Mar-22 4:59 
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
N 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
N 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
Victor Nijegorodov20-Mar-22 7:47 
GeneralRe: Mysql Update Query Error Pin
N Mohamed rafi20-Mar-22 8:44
N Mohamed rafi20-Mar-22 8:44 

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.