Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 February 3rd, 2005, 04:11 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update an access table

Hello, I have a code that should add a record to a table but it does not work .....could any one help me

<%on error resume next
Dim conn
Dim rs
Dim mySQL

Const adLockOptimistic = 3
Const adCmdText = 1
Const adUseClient = 3
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
Const adCmdTableDirect = 0

set conn=Server.CreateObject("ADODB.Connection")
conn.provider="Microsoft.Jet.OLEDB.4.0"
conn.open "\\10.91.32.34\Comc\summary_db.mdb"
mySQL = "INSERT INTO tblReconc_and_Controls (Global_Reference_No,RAM_Ref_No, Report_Name,Category, Objective, Location, Person_Monitoring, Applicable_Item(Y/N), Report_or_Audit, Frequency, System, SOX 404, Date_Last_Updated, Number_of_Lines, Percentage_Change_to_Previous_Run, Number_of_Customers, Date_To_be_Updated, Rectified_Reviewed)"
mySQL = mySQL & " VALUES ('" & request.form("Global_Reference_No") & "','" & request.form("RAM_Ref_No") & "','" & request.form(" Report_Name") & "','" & request.form("Category") & "','" & request.form(" Objective") & "','" & request.form(" Location") & "','" & request.form(" Person_Monitoring") & "','" & request.form(" Applicable_Item(Y/N)") & "','" & request.form(" Report_or_Audit") & "','" & request.form(" Frequency") & "','" & request.form(" System") & "','" & request.form(" SOX 404") & "','" & request.form(" Date_Last_Updated") & "','" & request.form(" Number_of_Lines") & "','" & request.form(" Percentage_Change_to_Previous_Run") & "','" & request.form(" Number_of_Customers") & "','" & request.form(" Date_To_be_Updated") & "','" & request.form(" Rectified_Reviewed") & "')"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM tblReconc_and_Controls", conn,adOpenKeyset, adLockOptimistic

Conn.execute(mySQL)
rs.Resync
Response.write "<BR><BR>"

Response.write("You have Added the Record " & Request.Form("ReportID"))
Response.write "<B>Thank you!</B>"
rs.Close
conn.close
Set rs = Nothing
Set conn = Nothing
%>
<BR>
</body>
</html>

 
Old February 3rd, 2005, 04:18 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Are u getting any error message? Please remove on error resume next and check the error.

Another thing,
Why this block of code:

Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM tblReconc_and_Controls", conn,adOpenKeyset, adLockOptimistic

Conn.execute(mySQL)
rs.Resync
Response.write "<BR><BR>"

Response.write("You have Added the Record " & Request.Form("ReportID"))
Response.write "<B>Thank you!</B>"
rs.Close
conn.close
Set rs = Nothing
Set conn = Nothing

when u can directly execute by Conn.execute(mySQL)

http://support.microsoft.com/kb/q250548/



Om Prakash
 
Old February 3rd, 2005, 04:24 PM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not getting any error but i will not add the record to the table when i tried it






Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help, Update MS Access table from datagrid yzlin04 VB Databases Basics 1 August 6th, 2007 07:22 AM
Update one table to another table using DTS in SQL Printmaker SQL Language 0 July 24th, 2007 07:17 AM
Update parent table with the sum of child table gbrown SQL Language 2 November 9th, 2004 07:53 AM
Access and update linked SQL Server 2000 table Lizu Access 9 May 10th, 2004 12:42 PM
Access update table from form values trevander Access VBA 2 April 28th, 2004 03:06 PM





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