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 August 4th, 2004, 02:40 PM
Authorized User
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default Insert Row Into Access Table With VBScript

Hi.

The following code is in an ASP page.

I'm getting an "Expected Statement" error on the line "!PPOName = sPPOName" in the code that's trying to insert a row into a 2 column MS Access table (1st column is AutoNumber):

Set oRS = Server.CreateObject("ADODB.Recordset")
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sConnAccess
sSQL = "Select * from PPOs Where 1 = 0" 'Just need table structure
oRS.Open sSQL,oConn,adOpenKeyset,adLockOptimistic

With oRS
    .AddNew
    !PPOName = sPPOName
    .Update
End With

oRS.Close
Set oRS = Nothing
oConn.Close
Set oConn = Nothing

Any suggestions?

TIA.

Rita
 
Old August 4th, 2004, 02:48 PM
Authorized User
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I figured it out!

I used ".Fields(1) = sPPOName" instead of "!PPOName = sPPOName" and it worked ok.
 
Old August 5th, 2004, 08:17 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

! is VB code usage, so you cannot use that there.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
insert row into table stealthdevil Access VBA 11 June 16th, 2007 08:32 AM
insert from one table to 2nd if row already exists brocktune SQL Server 2000 2 May 15th, 2007 12:56 AM
How I insert button into table for select row. oatza ASP.NET 2.0 Basics 5 May 10th, 2006 12:09 AM
Insert New Row into Table (VB 2005) adit9 Visual Basic 2005 Basics 0 March 3rd, 2006 03:25 AM
Problem with insert new row in *.dbo table dimeanel Pro VB.NET 2002/2003 1 January 23rd, 2006 12:05 PM





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