Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2007, 03:37 PM
Authorized User
 
Join Date: Jun 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble writing to an Access Database

I am geting an error when trying to add a new record to my database. I am able to read fromm the tables without any trouble but when i go to add a new record i get

Error Type:
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.


here is my code that I am useing to open the table

bjConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Data\Db.mdb;User Id=Admin;" & _
    "Password="

objRS.Open "Booking", objConnOpenDynamic,adLockOptimistic,adCmdTable


the part that is really confusing me is if i want to write to the table without ASP and just use straight VBScritp I am able to write to the table, of course I would rather use ASP to do this the only thing i can think of is working aroiund it by passing all my data to the vbscript page and then writing it and then redirecting off the page but this dose not sound the the most efficent way to handel it. Any one have any ideas?

Thanks for any help

Jim


 
Old June 26th, 2007, 08:43 AM
Authorized User
 
Join Date: Sep 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos99
Default

can you display a little more coding?
 
Old June 26th, 2007, 08:52 AM
Authorized User
 
Join Date: Sep 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos99
Default

TRY THIS.................

<HTML>
</HTML>
<%
Set bjConn = server.CreateObject("ADODB.Connection")
bjConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Data\Db.mdb;User Id=Admin; Password=pw"
Set objRS = server.CreateObject("ADODB.RecordSet")
SQL = "INSERT into tablename (column,column) VALUES('value','value')"

Set objRS = bjConn.Execute(SQL)
%>
 
Old June 26th, 2007, 08:54 AM
Authorized User
 
Join Date: Sep 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to misskaos99
Default

<HTML>
</HTML>
<%
'OR USE THE DRIVER RATHER THAN THE PROVIDER
Set bjConn = server.CreateObject("ADODB.Connection")
bjConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Db.mdb")
Set objRS = server.CreateObject("ADODB.RecordSet")
SQL = "INSERT into tablename (column,column) VALUES('value','value')"

Set objRS = bjConn.Execute(SQL)
%>
 
Old June 26th, 2007, 06:03 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

If you are getting records you do not need to change your connection string. (Go to connectionstrings.com to get the correct one for your needs)

Can get records but can not write to the table sounds like permissions on the folder where your .mdb file is. Has the IUSR got read and write permissions to this location? If not this is required - However, the error is usualy more like "Can not use an updatable query"

Wind is your friend
Matt
 
Old June 27th, 2007, 03:05 PM
Authorized User
 
Join Date: Jun 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actualy I found the problem it wasnt the connection string it was in the setup of my webserver. Thanks again for everyones help this message board has been a great learning tool for me.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Variables to an access database dsargent Classic ASP Basics 1 February 3rd, 2006 07:48 PM
Trouble writing database MDrumm Classic ASP Databases 5 August 4th, 2005 03:27 PM
writing to a ms access database angel79 Classic ASP Databases 2 May 25th, 2005 11:03 AM
Writing to access database from asp.et RaZorCleaN Access 2 October 9th, 2003 01:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.