Click here to Skip to main content
15,389,918 members
Home / Discussions / C#
   

C#

 
GeneralRe: mysql delete code error Pin
N Mohamed rafi19-Mar-22 23:05
MemberN Mohamed rafi19-Mar-22 23:05 
GeneralRe: mysql delete code error Pin
OriginalGriff19-Mar-22 23:35
mveOriginalGriff19-Mar-22 23:35 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 0:02
MemberN Mohamed rafi20-Mar-22 0:02 
GeneralRe: mysql delete code error Pin
OriginalGriff20-Mar-22 0:37
mveOriginalGriff20-Mar-22 0:37 
GeneralRe: mysql delete code error Pin
Richard MacCutchan20-Mar-22 2:13
mveRichard MacCutchan20-Mar-22 2:13 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 2:21
MemberN Mohamed rafi20-Mar-22 2:21 
GeneralRe: mysql delete code error Pin
Richard MacCutchan20-Mar-22 2:25
mveRichard MacCutchan20-Mar-22 2:25 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 1:58
MemberN Mohamed rafi20-Mar-22 1:58 
Sir, Pls understand i have tried what you said, first i check db has 13rows and now with cmd.ExecuteNonQuery(); this code running it shows record deleted successfully and db has no change, and i removed cmd.ExecuteNonQuery(); this line and run the code it shows the same, so pls change the code and give pls

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 = textBox6.Text;
string name = textBox7.Text;
string salary = textBox8.Text;
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
string query = "DELETE FROM employee WHERE employee_id=@employee_id AND employee_name=@employee_name AND employee_salary-@employee_salary";
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();
MessageBox.Show("Record Deleted Successfully");
cnn.Close();
DisplayData();
ClearData();
}
}
else
{
MessageBox.Show("Please Select Record to Delete");
}
i think if i am doing wrong i dont know about breakpoint how to do that

modified 20-Mar-22 8:04am.

GeneralRe: mysql delete code error Pin
OriginalGriff20-Mar-22 2:33
mveOriginalGriff20-Mar-22 2:33 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 2:46
MemberN Mohamed rafi20-Mar-22 2:46 
GeneralRe: mysql delete code error Pin
OriginalGriff20-Mar-22 3:26
mveOriginalGriff20-Mar-22 3:26 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 3:46
MemberN Mohamed rafi20-Mar-22 3:46 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 2:47
MemberN Mohamed rafi20-Mar-22 2:47 
GeneralRe: mysql delete code error Pin
N Mohamed rafi20-Mar-22 3:09
MemberN Mohamed rafi20-Mar-22 3:09 
GeneralRe: mysql delete code error Pin
Dave Kreskowiak20-Mar-22 4:51
mveDave Kreskowiak20-Mar-22 4:51 
GeneralConnection string Error VS to Mysql Pin
N Mohamed rafi18-Mar-22 20:32
MemberN Mohamed rafi18-Mar-22 20:32 
GeneralRe: Connection string Error VS to Mysql Pin
OriginalGriff18-Mar-22 21:04
mveOriginalGriff18-Mar-22 21:04 
GeneralRe: Connection string Error VS to Mysql Pin
N Mohamed rafi18-Mar-22 21:08
MemberN Mohamed rafi18-Mar-22 21:08 
GeneralRe: Connection string Error VS to Mysql Pin
OriginalGriff18-Mar-22 21:17
mveOriginalGriff18-Mar-22 21:17 
GeneralRe: Connection string Error VS to Mysql Pin
N Mohamed rafi18-Mar-22 21:27
MemberN Mohamed rafi18-Mar-22 21:27 
GeneralRe: Connection string Error VS to Mysql Pin
OriginalGriff18-Mar-22 22:35
mveOriginalGriff18-Mar-22 22:35 
GeneralRe: Connection string Error VS to Mysql Pin
N Mohamed rafi18-Mar-22 22:51
MemberN Mohamed rafi18-Mar-22 22:51 
GeneralRe: Connection string Error VS to Mysql Pin
OriginalGriff18-Mar-22 23:07
mveOriginalGriff18-Mar-22 23:07 
GeneralRe: Connection string Error VS to Mysql Pin
N Mohamed rafi18-Mar-22 23:15
MemberN Mohamed rafi18-Mar-22 23:15 
GeneralRe: Connection string Error VS to Mysql Pin
OriginalGriff18-Mar-22 23:28
mveOriginalGriff18-Mar-22 23:28 

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.