|
-
Oct 20th, 2004, 10:02 AM
#1
Thread Starter
Fanatic Member
recordsets...
hi all,
apparently i'm losing it here... i can't declare a recordset and have a normal usage of these.
in ASP.OLD i used:
Code:
Dim StrConnect as String
Dim Rs As ADODB.Recordset
StrConnect = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=c:\inetpub\wwwroot\mysite\database\mysite.mdb"
Rs=Createobject("Adodb.Recordset") 'connection to DB
Stropen="Select * FROM cmodc_login WHERE (Active AND iduser='" & iduser & "')"
Rs.Open StrOpen,StrConnect,3,3
if NOT Rs.eof then
do while not Rs.EOF
Response.Write(Rs("idname"))
Rs.MoveNext
loop
end if
Rs.close
'free memory
Set Rs=nothing
...can someone point me in the direction of how the code would look like in asp.net...?
thanks...
wc.
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Oct 20th, 2004, 11:29 AM
#2
Thread Starter
Fanatic Member
i finally managed using the datareader class, here's an example for anyone who needs it.
VB Code:
Dim StrConnect as String, StrOpen as string
Dim DBconn As OleDbConnection, DBcomm as OleDbCommand, DBread as OleDbDataReader
'connect
StrConnect = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
Data Source=c:\inetpub\wwwroot\mysite\database\mysite.mdb"
DBconn=New OleDbConnection(StrConnect) 'connection to DB
DBconn.Open()
Stropen="Select * FROM cmodc_login WHERE (Active AND iduser='" & iduser & "')"
DBcomm=New OleDbCommand(Stropen,DBconn)
DBread=DBcomm.ExecuteReader()
If DBread.Read then
'the datareader contains a resultset.
Response.Write DBread("idname")
End If
DBconn.close()
'free memory
DBconn = nothing
DBread = nothing
only, still not sure how to LOOP this...
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Oct 21st, 2004, 01:18 AM
#3
Originally posted by wildcat_2000
only, still not sure how to LOOP this...
While DBread.Read()
-
Oct 21st, 2004, 06:13 AM
#4
Thread Starter
Fanatic Member
thank you
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|