set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & "C:\Inetpub\wwwroot\folder\database.mdb"
I have found some articles on Microsoft talking about a ressolution like:
"Set the object's ParentCatalog property to a valid Catalog object,
-or-
make sure the Parent Catalog is associated with a valid ADO Connection Object. "
What line of code is this error raising on? Offhand, it doesn't sound like a problem with the initial database connection, but more with the accessing of a data field after a query has been made. (Unless I completely misread something...)
Does the error arise on the oConn.Open call, or later...?
0
There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
It looks like the error was not on the open, but when I migrated some databases to a different database some columns changed format. I am investigating it now. I will tell you in a moment.
I think that Thogek is correct--most often when I see that error, the sql select or recordset points to a field that does not exist in the table.
To make sure however, please try this page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<%
dim objConnection, strDataPath
strDataPath = "C:\Inetpub\wwwroot\folder\database.mdb"
set objConnection=Server.CreateObject("ADODB.Connection")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
& " Data Source= " & strDataPath & ";"_
& " Mode=Share Deny None;User Id=admin;PASSWORD=;"
objConnection.ConnectionTimeout = 15
objConnection.CommandTimeout = 10
objConnection.Mode = 3 'adModeReadWrite
if objConnection.state = 0 then
objConnection.Open strConnectString
end if
Response.write("The Connection State is: " & objConnection.State)
> when I migrated some databases to a different
> database some columns changed format
If any of your data columns changed name, make sure that the names you use in your code match the names of the columns in the data tables (as I believe Fritz is suggesting)...
0
GabrielCucutAuthor Commented:
It looks like it is happenning something similar to what you are saying.
After every connection there is an error check and a collector for all errors of different connections.
Which property of the recordset can I use to obtain the name of teh adodb connection that is failing?
1) Thogek observes that this error usually results from pointing at a non-existant field in the table or recordset
2) I concurred that is most often the case, but since there was some concern that the connection was not being made, I offered a simple test page. If this worked, then we could be reasonably sure that Thogek had it correct.
FtB
0
GabrielCucutAuthor Commented:
fritz_the_blank
I have tried the code and pasted it in an html file calling it check.html and when run only a blank page is loaded (all white background).
Okay, let's stop there and make clear that you are able to make a connection, and that is a good start!!!
Now, I am a little confused. Is this question about a problem grabbing data from an Access database or about making connections in general? If the former, we should try to get your data out and isolate why you were getting that error. If the latter, then we need to work on a new connection string.
FtB
0
GabrielCucutAuthor Commented:
Finally: The problem is connecting to an SQL Server table.
I think I have found where the problem is:
I have migrated an Oracle database to SQL Server and changed a "to_char( end_date, "dd/mm/yyyy")" function into "convert(char(10), end_date, 103)" and I think the problem is the first time I use this CONVERT function.
So, probably the error has more to do with SQL server than ASP. Anyway, I am using ADODB.Recordset, should I try another connection mechanism to use this transact-SQL-specific functions?
However, I am still not sure how the above relates to your original error...
FtB
0
GabrielCucutAuthor Commented:
Thanks, I have found it. The problem was:
Using CONVERT( ... end_date ...) the resulting variable is a "Expr1".
Later in the ASP the program wants to access the "end_date" column in the recordset.
I am not an Oracle expert, but maybe the TO_CHAR function does not need to put "AS END_DATE" after the function, and it seems that SQL Server does need that or either it puts an Expr1, Expr2, ... names.
(Thanks a lot, I think it is fair to concede some point to Thogek and the rest for you.)
I am happy to have helped but am curious, why the grade of B?
FtB
0
GabrielCucutAuthor Commented:
I just thought that grade Excellent was when a very-very difficult question is answered really straight forward. This was not the case, maybe because I didn't provide apropriate information to target the problem, however I still think that an Excellent is when an answer has been extremely valuable.
Fair enough. Just keep in mind that everyone who answers questions here does so on a voluntary basis without compensation, and for most of us, the points and the grade are a token of appreciation for time and effort spent. Moreover, in this instance, the answer had very little to do with the question posed. If you would like straightforward answers, be sure to take a lot of time to craft your question carefully. Otherwise, there is no way, other than sheer luck, for us to provide you with that straight forward response that you are looking for (providing that such an answer even exists!).
FtB
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.