i was programming an update statement on c# and SQL Database, for my grad project, i had everything going pretty fine and smooth until i faced a weird problem, once i finished my update statement, and was setting an if condition to catch the error, the msg string is giving me weird error
use of unassigned local variable
however here's the code below.
string msg;
if (MessageBox.Show("Are you sure you want to update book info?", "Updating", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
n.RunDml("Update into Book Values (" + txtID.Text + ",'" + txtName.Text + "','" + txtCond.Text + "','" + txtQuant.Text + "','" + txtSect.Text + "')");
if (msg == "ok")
{
MessageBox.Show("Updating successfully done! ", "Updating");
}
else
{
MessageBox.Show(msg);
}
}
any help? thanks.