I have details view with colum INVH_NO, INVH_TXN_TYPE, INVH_CUST_CODE, INVH_DT.
I want to update INVH_NO as the Last No+1 as new number as per INVH_TYPE when inserting new record;
When I went some forums i read suggestions as write procedure ;which i understand like this ; not sure it is complete and correct
Alter Procedure SP_nextTranNo
@TransType varchar(10)
@ NextNo int output
As
Begin
Select Top 1 INVH_No from OT_INVOICE_HEAD where INVH_TXN_CODE=@TRANSTYPE ORDER BY INVH_NO DESC
End
If all the syndex are correct it should return the last INVH_NO as per parameters passed.
( When I tested with MS SQL SERVER MANAGEMENT -Execute query: Select TOP 1 from OT_INVOICE_HEAD where INVH_TXN_CODE='FEES' ORDER BY INVH_NO DESC ----lists last invoice no as per FEES))
Now how I complete the stored procedure as per correct syntex - help to write this procedure
When and how (which event) to call this procedure in Details view - help to call this procedure and pass the parameter from input value INVH_TXN_CODE
How I can bind this output+1 to INVH_NO - help me to bind the value to DATA field
MY understanding is it must be done while updating?? as final step as data updating in table.
Thanks for your time and support
I want to update INVH_NO as the Last No+1 as new number as per INVH_TYPE when inserting new record;
When I went some forums i read suggestions as write procedure ;which i understand like this ; not sure it is complete and correct
Alter Procedure SP_nextTranNo
@TransType varchar(10)
@ NextNo int output
As
Begin
Select Top 1 INVH_No from OT_INVOICE_HEAD where INVH_TXN_CODE=@TRANSTYPE ORDER BY INVH_NO DESC
End
If all the syndex are correct it should return the last INVH_NO as per parameters passed.
( When I tested with MS SQL SERVER MANAGEMENT -Execute query: Select TOP 1 from OT_INVOICE_HEAD where INVH_TXN_CODE='FEES' ORDER BY INVH_NO DESC ----lists last invoice no as per FEES))
Now how I complete the stored procedure as per correct syntex - help to write this procedure
When and how (which event) to call this procedure in Details view - help to call this procedure and pass the parameter from input value INVH_TXN_CODE
How I can bind this output+1 to INVH_NO - help me to bind the value to DATA field
MY understanding is it must be done while updating?? as final step as data updating in table.
Thanks for your time and support