Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP.NET (Non-Forum Related)
 Driving me insane! VB.NET database access
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Dave.
Senior Member

USA
1037 Posts

Posted - 07 November 2004 :  17:39:15  Show Profile
All I want to do is this:

<%

dim conn, constr, rs
set conn = createobject("ADODB.Connection")
set rs = createobject("ADODB.Recordset")
connstr = "Provider=Microsoft.jet.oledb.4.0; Data Source=e:\mediadisplay.mdb"

conn.open connstr

set rs = conn.execute("select * from users where user='" & request.querystring("user") & "';")

StrUse = rs("something")

%>

... But in VB.NET. I can't for the life of me find anything that just gets one record, it gets a "Repeater" and I can't assign any of that to a string variable.. please help.

dayve
Forum Moderator

USA
5820 Posts

Posted - 07 November 2004 :  21:00:01  Show Profile  Visit dayve's Homepage
This works for me...

<%
Dim DataConn, cmdDC, rsDC, StrUse
DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open ("Provider=Microsoft.jet.oledb.4.0; Data Source=e:\mediadisplay.mdb")
cmdDC = Server.CreateObject("ADODB.Command")
cmdDC.ActiveConnection = DataConn
cmdDC.CommandText = ("select * from users where user='" & request.querystring("user") & "'")
cmdDC.CommandType = 1
rsDC = Server.CreateObject("ADODB.Recordset")
rsDC.Open (cmdDC, , 0, 1)

StrUse = rsDC("something")

rsDC.Close
rsDC = Nothing
cmdDC = Nothing
DataConn.Close
DataConn = Nothing
%>

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 08 November 2004 :  03:50:53  Show Profile  Visit HuwR's Homepage
quote:
set rs = conn.execute("select * from users where user='" & request.querystring("user") & "';")


It is extremely bad practise to use * in a select statement.
Go to Top of Page

Dave.
Senior Member

USA
1037 Posts

Posted - 08 November 2004 :  20:05:53  Show Profile
Thanks Dayve!

quote:
Originally posted by HuwR

quote:
set rs = conn.execute("select * from users where user='" & request.querystring("user") & "';")


It is extremely bad practise to use * in a select statement.



It was an example.... you should also not take input from a querystring without checking it first either. =)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07