Click to See Complete Forum and Search --> : Recordset question in ASP .NET


ruca
February 5th, 2004, 12:42 PM
Hi gurus,
I want to migrate an ASP aplication to ASP .NET, but it is being more difficulty that what I think initial.

In my ASP aplication I have a recordset turn off (that's the name that I call him). And you ask me, WHAT'S THAT?
Well...
I need to load to a dropdown control the name of people that are in a .TXT file, and for that I simulate a recordset withouT DB connection. This is the code of that recordset:


'Initialize
Set rs = Server.CreateObject("ADODB.Recordset")
rs.LockType = 3
rs.CursorLocation = 3
rs.Fields.Append "Cd", 8, 50, 4
rs.Fields.Append "Name", 8, 50, 4
rs.Fields.Append "Pwd", 8, 50, 4
rs.Open



'Fill the RecordSet
'I pass the file to the function
Sub ProcessUser(txtLine)
On Error Resume Next
p1 = instr(txtLine,",")
if p1>0 then
Cd=left(txtLine,p1-1)
LineAux = mid(txtLine,p1+1)
pos = instr(LineAux,",")
NameFunc = left(LineAux,pos-1)
Key = mid(LineAux, pos+1)

if rs.EOF then
rs.AddNew
rs("Cd")=Cd
rs("Name")=NameFunc
rs("Pws")=Key
rs.Update
end if
end if
End Sub



'Fill dropdown
<%
function fill_drop()
On Error Resume Next
ler_users
%>
<select name="func" size=1>
<option selected>-- escolha -- </option>
<%
rs.MoveFirst
While Not rs.EOF
%>
<option value="<%=rs.Fields("CdRcs")%>"><%=rs.Fields("NmAbreviado")%></option>
<!--<option value="<%=rs.Fields("CdRcs")%>"><%=rs.Fields("NmAbreviado")%></option>-->
<%rs.MoveNext
WEnd
rs.Close
'Set Conn = nothing
%>
</select>
<%
end function


The thing is that I'm new on ASP .NET and I can't do this because the methods are different. So I need your help to give me a good solution and sugest what's better and say what's the "substitute" for ADODB.Recordset

ITGURU
February 5th, 2004, 11:55 PM
In ASP.NET, ADO Recordset changed to Dataset, you can perform same functionality using Dataset.

For detail refer to DataSet in MSDN.