Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 3rd, 2005, 04:11 PM
Registered User
 
Join Date: Feb 2005
Location: , , .
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>

Reply With Quote
  #2 (permalink)  
Old February 3rd, 2005, 04:18 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
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
Reply With Quote
  #3 (permalink)  
Old February 3rd, 2005, 04:24 PM
Registered User
 
Join Date: Feb 2005
Location: , , .
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.