sqlCon.Open();
SqlCommand cmd = new SqlCommand("procDeliveryStock", sqlCon);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@id", labelID.Text));
cmd.Parameters.Add(new SqlParameter("@date", dateTimePicker1.Text));
cmd.Parameters.Add(new SqlParameter("@description", txtItemDescription.Text));
cmd.Parameters.Add(new SqlParameter("@dosage", txtDosage.Text));
cmd.Parameters.Add(new SqlParameter("@qty", txtQty.Text));
cmd.Parameters.Add(new SqlParameter("@selling", txtSelling.Text));
cmd.Parameters.Add(new SqlParameter("@receiving", txtReceiving.Text));
cmd.Parameters.Add(new SqlParameter("@plus", txtQty.Text));
sqlCon.Close();
and heres my Store Procedure
USE [BotikaNiChauncey]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[procDeliveryStock]
(
@id INT, @date DATETIME,
@description VARCHAR(50),
@dosage VARCHAR(50),
@selling MONEY,
@receiving MONEY,
@qty INT,
@plus INT,
@minus INT,
@stock INT
)
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRANSACTION
INSERT INTO Delivery
(
id, date, description, dosage, qty, selling, receiving
)
values
(
@id, @date, @description, @dosage, @qty, @selling, @receiving
)
IF @@ERROR = 0
BEGIN
INSERT INTO StockCard
(
descripton,dosage,[+],[-], stock
)
VALUES
(
@description, @dosage, @plus, @minus, @stock
)
IF @@ERROR = 0
BEGIN
COMMIT TRANSACTION
END
ELSE
BEGIN
ROLLBACK TRANSACTION
END
END
ELSE
BEGIN
ROLLBACK TRANSACTION
END
END
My problem is it is not saving in the database but there is no error on runtime.
Thanks in Advance