|
![]() |
|
| Author |
|
|||||||
|
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
Which is correct. So now I want to display this info in a browser, and I wrote this little test program in ASP:
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? |
|||||||
| #0 03:33pm 30/05/03 |
|
|||||||
|
system
|
--
|
|||||||
| #0 |
|
|||||||
|
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 |
|||||||
| #1 04:01pm 30/05/03 |
|
|||||||
|
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. |
|||||||
| #2 04:06pm 30/05/03 |
|
|||||||
|
Khel
Posts: 4670
Location: Brisbane, Queensland
|
The problem obviously comes from the fact you're writing in VBScript.
|
|||||||
| #3 04:11pm 30/05/03 |
|
|||||||
|
Eu4ia
Posts: 99
Location: Gold Coast, Queensland
|
are you sure your [edit]dsn's[/edit] pointing to the right database?
|
|||||||
| #4 04:14pm 30/05/03 |
|
|||||||
|
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?
|
|||||||
| #5 04:15pm 30/05/03 |
|
|||||||
|
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. |
|||||||
| #6 04:31pm 30/05/03 |
|
|||||||
|
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
|
|||||||
| #7 04:32pm 30/05/03 |
|
|||||||
|
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 :/
|
|||||||
| #8 04:33pm 30/05/03 |
|
|||||||
|
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. |
|||||||
| #9 05:29pm 30/05/03 |
|
|||||||
|
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. |
|||||||
| #10 05:59pm 30/05/03 |
|
|||||||
|
system
|
--
|
|||||||
| #10 |
|
|||||||
|
| ||||||||