public bool updateData(mitems k) { bool stat = false; try { Connection ConnG = new Connection(); ConnG.Konek(); strQuery = new MySql.Data.MySqlClient.MySqlCommand(); strQuery.Connection = ConnG.Conn; strQuery.CommandType = CommandType.Text; strQuery.CommandText = "UPDATE tblmitems SET DESCRIPTION=@Description,ITEMSTYPEID=@ItemsTypeID,TYPE=@Type,ACTIVE=@Active,IMAGE=@Image,PATH=@Path WHERE ITEMSID=@ITEMSID"; strQuery.Parameters.AddWithValue("@ITEMSID", k.ItemsID); strQuery.Parameters.AddWithValue("@Description", k.Description); strQuery.Parameters.AddWithValue("@ItemsTypeID", k.ItemsTypeID); strQuery.Parameters.AddWithValue("@Type", k.Type); strQuery.Parameters.AddWithValue("@Active", k.Active); strQuery.Parameters.AddWithValue("@Image", k.Image); strQuery.Parameters.AddWithValue("@Path", k.Path); strQuery.ExecuteNonQuery(); ConnG.Putus(); stat = true; } catch { } return(stat); }
public bool insertData(mitems k) { bool stat = false; try { Connection ConnG = new Connection(); ConnG.Konek(); strQuery = new MySql.Data.MySqlClient.MySqlCommand(); strQuery.Connection = ConnG.Conn; strQuery.CommandType = CommandType.Text; strQuery.CommandText = "INSERT INTO tblmitems VALUES(@ItemsID,@Description,@ItemsTypeID,@Type,@Active,@Image,@Path)"; strQuery.Parameters.AddWithValue("@ItemsID", k.ItemsID); strQuery.Parameters.AddWithValue("@Description", k.Description); strQuery.Parameters.AddWithValue("@ItemsTypeID", k.ItemsTypeID); strQuery.Parameters.AddWithValue("@Type", k.Type); strQuery.Parameters.AddWithValue("@Active", k.Active); strQuery.Parameters.AddWithValue("@Image", k.Image); strQuery.Parameters.AddWithValue("@Path", k.Path); strQuery.ExecuteNonQuery(); stat = true; ConnG.Putus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(stat); }