By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

fetching second row out put of stored procedure

P: 7
I have Stored Procedure like this:
Expand|Select|Wrap|Line Numbers
  1. ALTER procedure [dbo].[carcallvalidation]
  2.     @carid nvarchar(100)=null
  3.     as 
  4.     begin
  5.     select t.TBarcode, t.Paid,t.Status,t.DelDate from Transaction_tbl t where TBarcode=@carid
  6.     declare @transid integer=null
  7.     select @transid= t1.transactID from Transaction_tbl t1 where TBarcode=@carid
  8.     select count(k.transactid) transid from KHanger_tbl k where k.transactid=@transid
  9.     end
while executing stored procedure i am getting out put like this:

Tbarcode paid status
1111 0 2

Transid
2

Return value
0
I Fetchd first row value like this:

Expand|Select|Wrap|Line Numbers
  1.     Dim cmdcarvalidation As New SqlCommand("carcallvalidation", con.connect)
  2.     cmdcarvalidation.CommandType = CommandType.StoredProcedure
  3.     cmdcarvalidation.Parameters.Add("@carid", SqlDbType.VarChar, 50, ParameterDirection.Input).Value = txtTicket.Text
  4.     dr = cmdcarvalidation.ExecuteReader
  5.     While dr.Read
  6.  
  7.         tbarcode=dr("Tbarcode")
  8.         payd= dr("paid")
  9.        status= dr("status")
  10.      end while
while fetching transid value like this am getting error,,,is there any way to fetch second row value
Jun 24 '13 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
Could you include details of the error please?
Jul 20 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.