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 May 25th, 2008, 11:03 PM
Registered User
 
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add New Record in Access DB

Can anyone tell me how to remove the marked error on this page.

On running this page the error occurs that arguments dont match on the marked line.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome User</title>
</head>

<body>
<h1>Welcome!</h1>
<p>Thank You for logging on at<%=time%>, <% =date%>
<p><h1>Add new record</h1>
<strong>
<%

    dim objCon, objRS, intEmpID
    set objCon=server.CreateObject("ADODB.Connection")
    set objRS=server.CreateObject("ADODB.Recordset")

    objCon.Open "DSN=test"
    objRS.Open "Employees", objCon, adOpenStatic,adLockBatchOptimistic, adCmdTable
        objRS.MoveLast

    response.Write(objRS("EmployeesID"))
    response.Write(objRS("FirstName"))
    response.Write(objRS("MiddleName"))
    response.write(objRS("EAddress"))

    %>
</strong>
</body>
</html>

 
Old June 2nd, 2008, 01:13 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You have not *DEFINED* any values for adOpenStatic, etc.

You need to either include the "adovbs.inc" file or manually define those constants or just use the numbers.

That is:
(1)

but that assumes you *have* that file someplace in the same directory.

(2) Use CONST values:
    CONST adOpenStatic = 3
    CONST adLockOptimistic = 3
[just omit adCmdTable...you don't need it]

(3) As I said, just use the numbers directly:
    objRS.Open "Employees", objCon, 3, 3

Oh, and get rid of the
    objRS.MoveLast
line! It does ABSOLUTELY NOTHING except possibly hurt your performance.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADD DB RECORD/ RETURN ID Huascar82 Classic ASP Databases 1 October 1st, 2007 11:55 PM
how to add new record as first record in dataset [email protected] ASP.NET 1.0 and 1.1 Professional 4 April 21st, 2006 05:23 AM
Help with Add record topshed Classic ASP Basics 6 February 7th, 2006 02:59 AM
Cannot add new record geolando Access 0 June 27th, 2005 06:23 PM
How to add paging for access db using asp method Classic ASP Databases 1 June 3rd, 2005 02:12 PM





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