Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on asp connection string

Status
Not open for further replies.

jjones100

Technical User
Nov 12, 2004
23
US
Can someone tell me what the problem is with this connection string:
<%
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Project.mdb")
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Tasks",adoCon,,adLockOptimistic,adCmdTable
%>

The table i am trying to update is called tasks in the project db. I keep getting the following error:

"ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."

Any help would be appreciated. Thanks!
 
try removing the first equal sign from this line:

adoCon.Open [!]=[/!] "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Project.mdb")

When in doubt with connection strings, I always refer to:


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Thanks, but did not work. Same error message.
 
Try adding the following for debugging purposes only:
Code:
<%
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Project.mdb")
[red]
IF adoCon.State = 1 THEN
  Response.Write "<br>The ADO Connection is open<br>"
ELSE
  Response.Write "<br>The ADO Connection is closed<br>"
END IF
[/red]
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open "Tasks",adoCon,,adLockOptimistic,adCmdTable
%>
This should at least let you know if the connection is open.
 
Thanks for suggestion. Connection shows to be open.
 
Oh good catch DNG, if not use 3 in place of adLockOptimistic and 2 in place of adCmdTable.
 
You could also just see if this works:
Code:
<%
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Project.mdb")
[red]
Set rs = adoCon.Execute("SELECT * FROM Tasks")[/red]
%>
 
Thanks to everyone. Missing the adovbs.inc statement. Problem resolved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top