Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Error "Invalid object name" 2

Status
Not open for further replies.

Devistator

Technical User
Joined
Feb 16, 2007
Messages
9
Location
US
Not a professional. Lost my db guru and having problems with ms sql.

Help will be appreciated.


this is one of the errors i'm receiving, but actually the db is not getting read or updated by the asp.

"Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.Companies'.

/main.asp, line 124 "




here is the line:

Set rsCompany = conn.Execute(SQLQuery)

 
It sounds like you are not connected to the database. try this...

Add these lines ABOVE the conn.execute line.

[tt][blue]
Response.Write(Conn.ConnectionString)
Response.End
Set rsCompany = conn.Execute(SQLQuery)
[/blue][/tt]

Copy/paste the response here. If, by chance, a password is shown, then change it to XXXX before posting it here.


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
>>Set rsCompany = conn.Execute(SQLQuery)

the problem is obviously with SQLQuery, that lin just executes SQLQuery

it looks like the table dbo.Companies does not exists, are you in the correct DB?


Denis The SQL Menace
SQL blog:
 
qmmastros
here is the line

Provider=MSDASQL.1;Extended Properties="DSN=amcan2;UID=------;PWD=------;APP=Microsoft(R) Windows (R) 2000 Operating System;WSID=DEDI279"


sqldenis
table does exist


Thanks
 
>>sqldenis
table does exist

Okay what DB are you connecting to?

change your query to

select * from information_schema.tables
where table like 'C%'
order by table_name

and see if it shows up, maybe it is misspelled

Denis The SQL Menace
SQL blog:
 
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'table'.
 
For debugging purposes, try this...

[tt][blue]
Set rsTest = Conn.Execute("select @@Servername + ' -- ' + db_name())
Response.Write(rs(0))
Response.End
[/blue][/tt]

This will return the server name and database name.

Denis meant to say...

select * from information_schema.tables
where [!]table_name[/!] like 'C%'
order by table_name

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 

After running:
Set rsTest = Conn.Execute("select @@Servername + ' -- ' + db_name())
Response.Write(rs(0))
Response.End

got this message:

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '='.
Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark before the character string 'select @@Servername + ' -- ' + db_name())
Response.Write(rs(0))
Response.End
 
I'm sorry, it should have been:

[tt][blue]
Set rsTest = Conn.Execute("select @@Servername + ' -- ' + db_name()")
Response.Write(rsTest(0))
Response.End
[/blue][/tt]


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
amcan,dbo,Companies,BASE TABLE
amcan,dbo,Companies$,BASE TABLE
amcan,dbo,CompanyAwards,BASE TABLE
amcan,dbo,CompanyAwards$,BASE TABLE
amcan,dbo,CompanyContacts,BASE TABLE
amcan,dbo,CompanyContacts$,BASE TABLE
amcan,dbo,CompanyCustomers,BASE TABLE
amcan,dbo,CompanyCustomers$,BASE TABLE
amcan,dbo,CompanyEvents,BASE TABLE
amcan,dbo,CompanyEvents$,BASE TABLE
amcan,dbo,CompanyNews,BASE TABLE
amcan,dbo,CompanyNews$,BASE TABLE
amcan,dbo,CompanyOEMs,BASE TABLE
amcan,dbo,CompanyOEMs$,BASE TABLE
amcan,dbo,CompanyProfiles,BASE TABLE
amcan,dbo,CompanyProfiles$,BASE TABLE
amcan,dbo,CompanyQCs,BASE TABLE
amcan,dbo,CompanyQCs$,BASE TABLE
amcan,dbo,CompanyRDs,BASE TABLE
amcan,dbo,CompanyRDs$,BASE TABLE
amcan,dbo,CompanyServices,BASE TABLE
amcan,dbo,CompanyServices$,BASE TABLE
amcan,dbo,CompanySuppliers,BASE TABLE
amcan,dbo,CompanySuppliers$,BASE TABLE
amcan,dbo,CompanyTours,BASE TABLE
amcan,dbo,CompanyTours$,BASE TABLE
amcan,dbo,Countries,BASE TABLE
amcan,dbo,Countries$,BASE TABLE
 
I'm sorry, it should have been:


Set rsTest = Conn.Execute("select @@Servername + ' -- ' + db_name()")
Response.Write(rsTest(0))
Response.End



Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '='.
 
something i don't understand

running:
select * from information_schema.tables
where table_name like 'C%'
order by table_name

i didn't get all the tables from sql server
just starting with "Company" ???????????

i'm lost
 
where table_name like 'C%'

The like keyword allows you to use a wildcard (the percent symbol). So, this would read as... where table_name starts with the letter c



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Guys, it's like talking greek to me.
If you agree I'm ready to send you my login info for both SQL Server and webhost to take a look.

I don't have what to loose.
Please advise

Thanks
 
badidea.gif


____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done
 
i know, the forum policy forbid posting email addresses and personal info, but i can't find way of sending PM


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top