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 26th, 2007, 05:23 PM
Authorized User
 
Join Date: Feb 2007
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

Well, I successfully got it working to a degree. But, now there's another issue. I successfully added 1 item to the database. When I went to add another item, I got an error telling me that this update was not allowed because it would create a duplicate record. I thought this was strange, because I had added an item already. I printed out the database to screen and noticed that the new item had ID# "0". Instead of the highest number + 1. I think that each time I go to make an update to the DB, it tries to add another 0 to listnum column and it sees it as a duplicate.

Do you know of an easy way around this problem?

 
Old February 26th, 2007, 05:45 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

In Access set the column seed to 1

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old May 24th, 2007, 09:24 AM
Authorized User
 
Join Date: Feb 2007
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bonkbc Send a message via Yahoo to bonkbc
Default

Hello,

I'm getting an error that reads something like syntax error in "insert into" statement. I don't see anything glaringly wrong, do you??? : )

here is the code snippet in question:

    <%
    dim newtext
    newtext = request.Form("textspot")
    dim strSQL2

    strSQL2 = "INSERT INTO texteditor (text)" &_
             "VALUES ('" & newtext & "')"

    objconn.Execute strSQL2

    if objconn.Errors.Count = 0 then
        Response.Redirect "success.asp"
    else
        Response.Redirect "fail.asp"
    end if


    objconn.Close
    set objconn = nothing
%>

I'm also getting intermittent errors that state "Unspecified error"
dbconn.INC, line 7

which is my database connection include file. It's strange because sometimes the code is functional and works...but other times I get the unspecified error.

Any help would be greatly appreciated.

thank you,
brian

 
Old May 24th, 2007, 09:32 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The syntax error is probably be caused by the app trying to insert a string like this:

dim newtext
newtext = "Hello! It's very warm outside"

In this case, your insert fails because of the '' in the newtext string because it causes termination of the SQL string when its executed. Replace ' with '' and that will solve your problem.

The unspecified error I can not help you with.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
parametising sql statements in ASP classic trufla Classic ASP Basics 5 June 18th, 2008 02:38 PM
CASE Statements in T-SQL atcs2152 SQL Server 2000 3 April 28th, 2006 10:53 AM
Sql statements in data adapter Raif ASP.NET 1.0 and 1.1 Basics 1 July 14th, 2004 08:50 AM
SQL Statements marmer Classic ASP Basics 3 November 13th, 2003 01:42 AM
Quoting variables in SQL statements tp194 Classic ASP Databases 1 July 4th, 2003 03:41 AM





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