Monday, March 12, 2012

Repeater and Stored PRocedure

Q1 - I want to compare file names uploaded by users with the name of the file present in the database.
I have a repeated control that shows the data alongwith an array of <input type=file> that is created
dynamically when the data is displayed in the repeater control. (So there is an input tag within the
ItemTEmplate tag in the repeater)
Now I want to compare the names of the files uploaded by the user with the values as displayed in the
repeater. Is there a way I can do this? So I need to be able to get the data (for example Name) as
displayed in the repeater control into a variable like Dim strName As String. Something like:
Dim strName As String = (value from the repeater control)
Can I do this? How?

Q2 - I want to return a value from a stored procedure that will be stored in a variable in VB and will be
used for comparison. So, I want to return a 0 or 1 and then use .ReturnValue method to store this value.
The problem that I am facing is that I am using a cursor. And as soon as return is called in the SP it exits
the procedure and returns only one value (1 if found 0 otherwise) So it does not loop through the complete
cursor. What can I do to fix this?
CODE:

OPEN cur1
--print 'Cursor Open'
FETCH NEXT FROM cur1 INTO @.varFile, @.varFileEx, @.varFileSt

WHILE @.@.FETCH_STATUS = 0
BEGIN
IF (@.varFile = @.FileName AND @.varFileEx = @.FileExt)
BEGIN
set @.varReturn = 0
END
ELSE
BEGIN
set @.varReturn = 1
END
FETCH NEXT FROM cur_FileSystem INTO @.varFileName, @.varFileExt, @.varFileStatus
return (@.varReturn)
END
CLOSE cur_FileSystem
DEALLOCATE cur_FileSystem


Please help.
Thanks

Once you call Return, the stored procedure is exited. So your loop is never executed more than once. It is difficult to tell exactly what you are trying to do, but clearly what you are doing will not return a result of more than a single row.|||Any help with Q 1 ?

No comments:

Post a Comment