Professional Web Applications Themes

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name - ASP

Hi, I am able to retrieve data from database and then the object name is fine, say SELECT * FROM problemdb, but when I try to use INSERT, I get the error in subject. The access rights are enough, as far as I can see, and the error only comes from ASP page, not when I do it with windows scripting host (or cscript). I use the following command in ASP, is it ok? <% set Conn = CreateObject ("ADODB.connection") Conn.Open "driver={SQL Server};server=ip.ad.re.ss;uid=myself;pwd=mypasswd ;database=mydatabase" %> So I explicitely connect to the database I want to. Could anyone say what's the ...

  1. #1

    Default [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

    Hi,

    I am able to retrieve data from database and then the object name is fine,
    say SELECT * FROM problemdb, but when I try to use INSERT, I get the error
    in subject.

    The access rights are enough, as far as I can see, and the error only comes
    from ASP page, not when I do it with windows scripting host (or cscript).

    I use the following command in ASP, is it ok?
    <%
    set Conn = CreateObject ("ADODB.connection")
    Conn.Open "driver={SQL
    Server};server=ip.ad.re.ss;uid=myself;pwd=mypasswd ;database=mydatabase"
    %>

    So I explicitely connect to the database I want to.

    Could anyone say what's the problem? I think it might be the connection I'm
    using... I've seen it done differently, but this works

    The SQL server is in the same server as the IIS where I run the pages.

    Thanks for the help.


    Nico Leiska Guest

  2. #2

    Default Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name


    Nico Leiska" <nadlopipari.net.invalid> wrote in message
    news:evhiHRk8DHA.2416TK2MSFTNGP10.phx.gbl...
    > Hi,
    >
    > I am able to retrieve data from database and then the object name is fine,
    > say SELECT * FROM problemdb, but when I try to use INSERT, I get the error
    > in subject.
    >
    > The access rights are enough, as far as I can see, and the error only
    comes
    > from ASP page, not when I do it with windows scripting host (or cscript).
    >
    > I use the following command in ASP, is it ok?
    > <%
    > set Conn = CreateObject ("ADODB.connection")
    > Conn.Open "driver={SQL
    > Server};server=ip.ad.re.ss;uid=myself;pwd=mypasswd ;database=mydatabase"
    > %>
    >
    > So I explicitely connect to the database I want to.
    >
    > Could anyone say what's the problem? I think it might be the connection
    I'm
    > using... I've seen it done differently, but this works
    >
    > The SQL server is in the same server as the IIS where I run the pages.
    >
    > Thanks for the help.
    >

    Personal preference is not to use ODBC.

    Provider=SQLOLEDB.1;Persist Security Info=True;User
    ID=myself;Password=mypasswd;Initial Catalog=mydatabase;Data
    Source=ipaddresss

    But, it is impossible to tell what the problem is without seeing the Sql
    insert statement and relevant code that causes the error.


    --
    John Blessing

    [url]http://www.LbeHelpdesk.com[/url] - Help Desk software priced to suit all
    businesses
    [url]http://www.free-helpdesk.com[/url] - Completely free help desk software !
    [url]http://www.lbetoolbox.com[/url] - Remove Duplicates from MS Outlook
    "


    John Blessing Guest

  3. #3

    Default Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name


    Nico Leiska wrote:
    > Hi,
    >
    > I am able to retrieve data from database and then the object name is
    > fine, say SELECT * FROM problemdb, but when I try to use INSERT, I
    > get the error in subject.
    >
    If the table's owner is different from the logged-in user, you will probably
    have to explicitly qualify the table's name with the owner's name:
    dbo.problemdb

    HTH,
    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  4. #4

    Default Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

    > I am able to retrieve data from database and then the object name is fine,
    > say SELECT * FROM problemdb,
    problemdb is a table name? What an awkward and confusing naming scheme.
    > but when I try to use INSERT, I get the error
    > in subject.
    Sounds like you only have SELECT access to the table. Or you are part of
    the datareader role but not datawriter.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  5. #5

    Default Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

    Show us the INSERT statement, please.

    --
    Manohar Kamath
    Editor, .netWire
    [url]www.dotnetwire.com[/url]


    "Nico Leiska" <nadlopipari.net.invalid> wrote in message
    news:evhiHRk8DHA.2416TK2MSFTNGP10.phx.gbl...
    > Hi,
    >
    > I am able to retrieve data from database and then the object name is fine,
    > say SELECT * FROM problemdb, but when I try to use INSERT, I get the error
    > in subject.
    >
    > The access rights are enough, as far as I can see, and the error only
    comes
    > from ASP page, not when I do it with windows scripting host (or cscript).
    >
    > I use the following command in ASP, is it ok?
    > <%
    > set Conn = CreateObject ("ADODB.connection")
    > Conn.Open "driver={SQL
    > Server};server=ip.ad.re.ss;uid=myself;pwd=mypasswd ;database=mydatabase"
    > %>
    >
    > So I explicitely connect to the database I want to.
    >
    > Could anyone say what's the problem? I think it might be the connection
    I'm
    > using... I've seen it done differently, but this works
    >
    > The SQL server is in the same server as the IIS where I run the pages.
    >
    > Thanks for the help.
    >
    >

    Manohar Kamath [MVP] Guest

  6. #6

    Default Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

    > > I am able to retrieve data from database and then the object name is
    fine,
    > > say SELECT * FROM problemdb,
    >
    > problemdb is a table name? What an awkward and confusing naming scheme.
    Just a misthought, it was ment to be problemtable, not db
    > > but when I try to use INSERT, I get the error
    > > in subject.
    >
    > Sounds like you only have SELECT access to the table. Or you are part of
    > the datareader role but not datawriter.
    I do have access to modify the database since I'm the owner, and the "same"
    script does work with windows scripting host, also the SQL statements are
    identical.

    I don't think it is the SQL syntax, since I've been trying in so basic level
    that it is 100% correct. The problem, I think, that SQL Server just does not
    allow me to insert data for some reason.



    Nico Leiska Guest

  7. #7

    Default Re: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

    Without looking at your INSERT statement, it would be just a guessing match.

    --
    Manohar Kamath
    Editor, .netWire
    [url]www.dotnetwire.com[/url]


    "Nico Leiska" <nadlopipari.net.invalid> wrote in message
    news:umHIfAt8DHA.2480TK2MSFTNGP10.phx.gbl...
    > > > I am able to retrieve data from database and then the object name is
    > fine,
    > > > say SELECT * FROM problemdb,
    > >
    > > problemdb is a table name? What an awkward and confusing naming scheme.
    >
    > Just a misthought, it was ment to be problemtable, not db
    >
    > > > but when I try to use INSERT, I get the error
    > > > in subject.
    > >
    > > Sounds like you only have SELECT access to the table. Or you are part
    of
    > > the datareader role but not datawriter.
    >
    > I do have access to modify the database since I'm the owner, and the
    "same"
    > script does work with windows scripting host, also the SQL statements are
    > identical.
    >
    > I don't think it is the SQL syntax, since I've been trying in so basic
    level
    > that it is 100% correct. The problem, I think, that SQL Server just does
    not
    > allow me to insert data for some reason.
    >
    >
    >

    Manohar Kamath [MVP] Guest

Similar Threads

  1. Replies: 6
    Last Post: September 2nd, 01:22 PM
  2. Replies: 2
    Last Post: July 20th, 11:36 AM
  3. Replies: 1
    Last Post: December 13th, 02:59 AM
  4. Replies: 7
    Last Post: December 8th, 07:38 PM
  5. Replies: 0
    Last Post: November 1st, 10:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139