ASP.NET - How to write stored procedure with loop passing form asp.net

Asked By bhanupratap singh on 26-Nov-12 06:37 AM

I have two table
1. Consignment
2. Delivery

I need to check data into consignment. If record exist in consignment table then I need to check this very record into delivery table. if Record matches with consignmnet table with delivery datable, then ok. If record does not matches then all columns from consignmnet(first table) table of that record should come out and bind it to gridivew.
thanks
Check this procedure it does not full fill my need
ALTER procedure [dbo].[sp_SelectOutStandingggg]
(@CODE_NAME varchar(40) ,@TOO varchar(40) ,@sdate DATE,@edate DATE)
as
begin
select cn.CODE_NAME as Booking_Branch,cn.CNMT,cn.TOO,cn.CNDT,cn.GOODS,cn.TOTAL,cn.NOPKG,cn.CWGHT,cn.DC,cn.PVTMARKA from CONSIGNMENT as cn join DELIVERY as dlv on cn.CODE_NAME+cn.CNMT<>dlv.CODE_NAME+dlv.CNMT where cn.CODE_NAME=@CODE_NAME and TOO=@TOO and (CNDT BETWEEN @sdate AND @edate) order by cn.CODE_NAME end