top_left top_right
bottom_left
Next Event: Unknown | Forum Rules | QGL Website | Event Registration
openFolder AusForums.com
iconwatfolderLineopenFolder LANs
iconwatfolderLineopenFolder QGL
iconwatfolderLineopenFolder QGL Forum
Author
Topic: Need asp/sql help
teenieee
Posts: 10907
Location: Brisbane, Queensland
Hi I'm having problems with ASP / SQL (Oracle Database).

When I run this query through SQLplus:

SQL> select clientName from MapItems;


this result comes up


CLIENTNAME
----------
Frank


Which is correct.

So now I want to display this info in a browser, and I wrote this little test program in ASP:


<%
set db =Server.CreateObject("ADODB.Connection")
db.open "DSN=mydsn;UID=myuser;PWD=mypass"
set client = db.execute("select clientName from MapItems")
do until client.EOF
Response.Write("<b>"&client("clientName")&"<b>")
client.MoveNext
loop
db.close
%>


and nothing comes up

I wrote another one which checks for client.EOF, and it's always client.EOF indicating there are no records, but they're there !!

whyforthisproblem?
system
--
Jim
Posts: 1885
Location: Brisbane, Queensland
Been a long time since I've done vbscript but I think you're missing a recordset object. Something like:

set rs = server.createobject("ADODB.Recordset")

do until rs.EOF
Response.Write("<b>" & rs("clientName") & "<b>")
rs.MoveNext
loop

Just check some docs to make sure

Opec
Posts: 502
Location: Brisbane, Queensland
Nah Jim he doesn't actually need to explicitly create the Recordset object because the statement

set client = db.execute("select clientName from MapItems")

It will create one for him automajically. That's a pretty strange problem teen. What type of the column is it? VARCHAR or TEXT? Also I see you're using ODBC to connect, maybe you should try to use Oracle native driver to connect to see if that fixes the problem.
Khel
Posts: 4670
Location: Brisbane, Queensland
The problem obviously comes from the fact you're writing in VBScript.
Eu4ia
Posts: 99
Location: Gold Coast, Queensland
are you sure your [edit]dsn's[/edit] pointing to the right database?
Eu4ia
Posts: 100
Location: Gold Coast, Queensland
also... when you logged into sql plus, did you use the same usernam / password as in your dsn?

teenieee
Posts: 10908
Location: Brisbane, Queensland
I'm writing in asp not vbscript, if there is another syntax for asp, please tell me, cos this method is s***ting me, i keep putting semicolons on the end of things, and using brackets and stuff out of habit.

Pretty sure the login stuff is correct because I can insert into the database from asp fine.

Jim
Posts: 1888
Location: Brisbane, Queensland
asp is just the framework which makes using some scripting languages via IIS possible - the language you are using there is vbscript

teenieee
Posts: 10909
Location: Brisbane, Queensland
well all the google results on asp/sql seem to use this method so I better stick with it :/
Khel
Posts: 4671
Location: Brisbane, Queensland
You can write ASP in JScript as well, which if you're used to C/Java is probably easier to get to grips with (it follows all the conventions of semi colons after lines, etc).

Check out http://msdn.microsoft.com and look up Windows Scripting Host and find the JScript language reference, its pretty helpful and outlines all the objects and functions and whatever else that exists in JScript. You'd prolly be able to find a lot of useful references for ASP and ADO on there as well (ADO is what you're using to access the database, its the collection of objects and functions and stuff you use to open database connections, create recordsets, etc)

But yeah, a lot of ASP examples come in only one flavour, VBScript, so it can be annoying sometimes.
sKryBe
Posts: 2099
Location: Brisbane, Queensland
You do have spaces in the code don't you? Smooshing it all together like it's displayed there could cause dramas. Also, you don't need the brackets around the response writes. I don't think that would be causing problems, but they're not necessary.

I'd also do it the same way as Jim - ie; explicitly use a recordset rather than relying on it to implicitly create one.

You could also do the trusty response.write "Woohoo" to see whether it's actually working. Basically you put that in and run the code. Then move the line down to the next line and run the code, and so on until you no longer see a "Woohoo" on your page. Then at least you know where it's breaking.
system
--
Not a new post since your last visit.
New Post Since your last visit
Back To Forum
Advertise with Us | Privacy Policy | Contact Us
© Copyright 2001-2026 AusGamers Pty Ltd. ACN 093 772 242.
Hosted by Mammoth Networks - Australian VPS Hosting
Web development by Mammoth Media.