How to update an .fdb database from a form
I can't update my firebird database from a form, while i can update it from the datagrid.
I want to fill out some text boxes on a form and then save the data into a database.
I'm using this function to do it, and it reports the message "Item Update Successfull!" but it doesn't actually save the data into a database :(
Can someone help me?
PS: this is the function i use to update stuff
public void CatchSaveClick(object source, System.EventArgs e)
{
try
{
fbConnection1.Open();
FbTransaction myTxn = fbConnection1.BeginTransaction();
this.fbDataAdapter1.UpdateCommand.Transaction = myTxn;
this.fbDataAdapter1.UpdateCommand.CommandText = "UPDATE Weapons SET NAME = '"+Dos.itmName.Text+"', DESCRIPTION =" +
" '"+Dos.itmDescription.Text+"', WEAPON_TYPE = '"+Dos.itmTypeList.Text+"', DAMAGE_TYPE = '"+Dos.itmDamageType.Text+"', MINIMUM_DAMAGE = '"+Dos.itmMinDamage.Text+"', MAXIMUM_DAMAGE = '"+Dos.itmMaxDamage.Text+"', " +
"RANGE = '"+Dos.itmRange.Text+"', SPEED = '"+Dos.itmSpeed.Text+"', WEIGHT = '"+Dos.itmWeight.Text+"', PICTURE = '"+Dos.picPath.Text+"', ITEM_PRICE = '"+Dos.itmValue.Text+"', PARRY = '"+Dos.itmParry.Text+"' WHERE ID = "+Dos.itmIDNumber.Text;
fbDataAdapter1.UpdateCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
fbConnection1.Close();
Reset_Grid();
MessageBox.Show("Item Update Successfull!");
}
}