SELECT queries work, INSERT and UPDATE fail?

Discussion in 'ASP General' started by Paul, Jun 23, 2005.

  1. Paul

    Paul Guest

    I have run into a strange problem with a site I am working on. My SELECT
    queries work fine, but I just tried to add an UPDATE statement and it fails.
    A test showed that INSERT fails also. I created a new table just for testing
    called "blah" and it had the same results.

    My statements:
    "UPDATE GiftCerts SET Paid=1 WHERE CertSerial='2005-0001'"
    and
    "INSERT INTO blah (test) VALUES ('something')"

    Here is the error message:

    Microsoft OLE DB Provider for SQL Server error '80040e37'
    Invalid object name 'blah'.

    I do not have admin access, as this is on a shared hosting account. However,
    I have set up many sites under supposedly identical configurations and never
    once had this problem. If it was a permissions issue I would think a
    different error would result?

    Thanks for your help.
    Paul
     
    Paul, Jun 23, 2005
    #1
    1. Advertisements

  2. Let's see the code you use to execute these statements.(we don't want to
    plow through your whole page to find the relevant bits - please extract just
    the sections where the statements are built and executed.)
     
    Bob Barrows [MVP], Jun 23, 2005
    #2
    1. Advertisements

  3. Paul

    Paul Guest

    Thanks for the reply.

    I just found the cause. It helps when the connection string is pointing to
    the correct database!! I had copied my connection strings from another
    project and only changed the database and authentication in the one used for
    SELECT queries.

    This ranks as one of the most bone-headed mistakes I've made. Sorry to waste
    your time.

    Paul
     
    Paul, Jun 23, 2005
    #3
  4. Paul

    Roland Hall Guest

    in message : I just found the cause. It helps when the connection string is pointing to
    : the correct database!! I had copied my connection strings from another
    : project and only changed the database and authentication in the one used
    for
    : SELECT queries.

    FYI... It's either permissions or the table doesn't exist. In this case,
    the latter.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Jun 23, 2005
    #4
  5. Paul

    Ken Jenkins Guest

    your connection string is pointing to the wrong database
     
    Ken Jenkins, Jun 27, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.