View Full Version : Database Issues
The Wizzard
12-18-2002, 01:47 AM
Im trying to get info from my database... Im getting this error...
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x538 Thread 0x988 DBC 0x36afc44 Jet'.
/oc/info.asp, line 11
Line 11 looks like:
objConection.Open strConnectString
Mhtml
12-18-2002, 01:49 AM
I believe it is refering to the database not being where you have specified. Check you strConnectionString variable.
EDIT: Or possibly your connection string isn't right.
Can we see the strConnectionString variable?
The Wizzard
12-18-2002, 01:56 AM
strConnectString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("car.mdb")
I have used this string for most of my sites, and really no problems... Wonder what it could be?
The Wizzard
12-18-2002, 01:59 AM
lol, i am such a loser, i spelt the db name wrong, lol, its cars not car
hehe...
Now im getting this error though
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/oc/info.asp, line 19
Line 19 looks like:
objlist.Open strSQL, objConection, adOpenStatic, adLockReadOnly, adCmdText
Mhtml
12-18-2002, 02:03 AM
I've never seen a line like that before. I think I will have to go learn about it.
Also you have
strConnectionString = "DRIVER={Microsoft Acc...
I tend to do it without the =
strConnectionString "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb")
I don't know why, I was told by Whammy I think.
The Wizzard
12-18-2002, 02:41 AM
Okay, I got everything to work fine... But heres the deal now...
I have a page, showroom.asp on the page there are links...
<a href="info.asp?ID=1">Car 1</a>
<a href="info.asp?ID=2">Car 2</a>
Now, on info.asp is where my database stuff is, and stuff...
When you go to it, if the query is info.asp?ID=1 then all the info for car 1 should show, if it was info.asp?ID=2 then it woud show all the info about car 2
But its not, no matter what the query is, it always shows car 1.
I should know this, but i havent done anything in ASP in so long... :( I have forgoten tons of things...
Mhtml
12-18-2002, 02:47 AM
Can I see the Sql Query string?
It should look something like
SELECT * FROM TableName WHERE CarId = " & Request.QueryString("ID")
The Wizzard
12-18-2002, 02:58 AM
Okay, here is what I have now... (your code included)
<%
Dim strSQL
Dim objConection
Dim objlist
Dim strConnectString
' Create Connection
strConnectString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("cars.mdb")
Set objConection = Server.CreateObject ("ADODB.Connection")
objConection.Open strConnectString
' Create Recordset
Set objlist = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM list WHERE ID = " & Request.QueryString("ID")= """"
objlist.Open strSQL, objConection, adOpenStatic, adLockReadOnly, adCmdText
%>
Now im getting this error
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/oc/info.asp, line 19
Line 19 looks like:
objlist.Open strSQL, objConection, adOpenStatic, adLockReadOnly, adCmdText
Mhtml
12-18-2002, 03:05 AM
I've no idea why you have the = """" at the end of your query but I think that is the problem.
strSQL = "SELECT * FROM List WHERE ID = " & Request.QueryString("ID")
That is what your sql query should be, change it to that and see what happends.
The Wizzard
12-18-2002, 03:09 AM
Yes, thank you VERY much buddy...!!!
I used
strSQL = SELECT * FROM List WHERE ID = " & Request.QueryString("ID")
at first, and it didnt work, then i tried to use all those """ but all i needed to do was use your code, and do this...
strSQL = "SELECT * FROM List WHERE ID = " & Request.QueryString("ID")
Mhtml
12-18-2002, 03:19 AM
Hey, no worries. Your post actually got my mind onto sql and I figured out one of my queries which wsa bugging me..
SqlGetForums = "SELECT Forums.*, Moderators.*, Users.* FROM Forums, Moderators, Users WHERE ForForum = ForumId AND ModeratorId = Users.UserId "
whammy
12-19-2002, 12:54 AM
Wow, that's a lot of stuff you're selecting, Mike... ;)
FYI, if you end up using a database with a LOT of records in it, using * (all), especially on three different tables, might slow it down quite a bit, or perhaps cause it to time out. If you run into that problem, you might want to specify which fields you want to select for each database... just a tip. :D
Tip for The Wizzard,
if an error points to a line like your "line 19", then the error is usually not on that line, buth on one of the lines above. This is becaus the sql string (strSQL) got read and processed here. In the lines above, this statament is just a string, but here, it becomes an sql-statement.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.