public bool updateData(mstore 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 tblmstore SET NAME=@Name,ADDRESS=@Address,ACTIVE=@Active WHERE STOREID=@StoreID"; strQuery.Parameters.AddWithValue("@StoreID", k.StoreID); strQuery.Parameters.AddWithValue("@Name", k.Name); strQuery.Parameters.AddWithValue("@Address", k.Address); strQuery.Parameters.AddWithValue("@Active", k.Active); strQuery.ExecuteNonQuery(); ConnG.Putus(); stat = true; } catch { } return(stat); }
public bool insertData(mstore 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 tblmstore VALUES(@StoreID,@Name,@Address,@Active)"; strQuery.Parameters.AddWithValue("@StoreID", k.StoreID); strQuery.Parameters.AddWithValue("@Name", k.Name); strQuery.Parameters.AddWithValue("@Address", k.Address); strQuery.Parameters.AddWithValue("@Active", k.Active); strQuery.ExecuteNonQuery(); stat = true; ConnG.Putus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(stat); }