Recordset question in ASP .NET

R

ruca

Hi,
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:



code:-----------------------------------------------------------------------
-------
'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


__________________
Hope it will help you (if I try to help you)
Thanks (if you try to help me),
ruca
 
S

Scott M.

I would bypass the recordset all together and just read from the text file
(parsing the names) and place them in the drop down box. Also, .NET uses
ADO.NET as its native database connectivity paradigm. ADO.NET doesn't use
the ADO Recordset, it uses a new group of objects for storing disconnected
copies of data.
 
R

ruca

But then when I want to go to next step (click on a button) I want a
comparsion of the input password with the key that person have associated in
..TXT file.
How can you sugest to do that?

ruca
 
S

Scott M.

Again, this is not something that you "need" a database or recordset for.
You could simply read the data in from the text file (names and passwords)
and store them in an array, a collection, a hash table, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top