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 November 3rd, 2003, 06:13 PM
Authorized User
 
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default trouble adding new record

Hi guys, I need your help once again... This does add to the data base but displays this error.. here is my error
----------------
Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/curves/Insert.asp, line 135
--------------------

Dim objRS, intIDForNewRecords
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open "tblIThelp",strStatus,adOpenStatic,adLockOptimisti c,adCmdTable
-------
objRS.MoveLast
intIDForNewRecords = objRS("ID") + 1
objRS.AddNew
objRS("ID") = intIDForNewRecords
some html stuff and then
-------
line 135 objRS.Open "Select * FROM tblIThelp WHERE ID=" & intIDForNewRecords, _
strStatus, adOpenForwardOnly, adLockReadOnly, adCmdText
 
Old November 4th, 2003, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

From the error, it looks like you are trying set a string equal to a number. Maybe...

Change:
objRS.Open "Select * FROM tblIThelp WHERE ID=" & intIDForNewRecords, _
 strStatus, adOpenForwardOnly, adLockReadOnly, adCmdText

To:
objRS.Open "Select * FROM tblIThelp WHERE ID= '" & intIDForNewRecords & "'", _
 strStatus, adOpenForwardOnly, adLockReadOnly, adCmdText

Or do Type conversion on the variable "intIDForNewRecords" if that doesn't work. It depends on what your data types are in the database.

J





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding record to database? werD420 Classic ASP Databases 5 January 20th, 2005 06:27 PM
Trouble creating a Copy Record command on a Form Ron V Access 0 May 19th, 2004 01:36 PM
Adding a new record to a dataset Louisa VB.NET 2002/2003 Basics 1 January 14th, 2004 05:33 PM
Add New compliling, but not actually adding record Louisa VB.NET 2002/2003 Basics 1 January 12th, 2004 11:15 AM
Adding a record using a form cailos Access 2 October 12th, 2003 11:10 PM





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