Click here to Skip to main content
15,937,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The following Stored procedure created to use with C# 2005. Now, I would like to convert this procedure to MySQL / C#.

Please help me to change to use with the C# 2005.
SQL
CREATE PROCEDURE AUTOGENERATEBILLNUMBER 
(
@ACCYEAR INT
)
AS	
BEGIN
	DECLARE @COUNT INT
	DECLARE @BILLNUMBER INT
	DECLARE @MAXBILLNUMBER INT
	DECLARE @LENGTH INT

	SELECT @MAXBILLNUMBER  = MAX(BILL_NO) FROM BILLS WHERE ACC_YEAR = @ACCYEAR
	IF(@MAXBILLNUMBER IS NULL)
	BEGIN
	SET @MAXBILLNUMBER = 1
	
	END

	ELSE
	BEGIN
	SET @MAXBILLNUMBER = @MAXBILLNUMBER + 1
	
	END
	INSERT INTO BILLS (BILL_NO,ACC_YEAR) VALUES (@MAXBILLNUMBER,@ACCYEAR)
END
GO
Posted
Updated 20-Jan-13 3:17am
v3

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900