473,699 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help! SQL Server error - [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name ...

Dear all,

On Win2000 server with SP3, I am trying to access a SQL Server 7.0
database, "TestDB", from VB6 via a SQL Server ODBC system DSN using ADO
2.7. In SQL Server Enterprise Manager, there is a login named "Tester".
In its property window, NO "Server Roles" was assigned but its
"Database Access" was set to "TestDB". This login was also made as the
user of "TestDB" with "public", "db_datarea der" and "db_datawri ter"
selected as its "Database role membership". All the tables I am trying
to access in "TestDB" were created under "Tester".

My code is like:

Set conn = New ADODB.Connectio n
conn.Open "DSN=TestDSN;UI D=Tester;PWD=te st"

Set cmd = New ADODB.Command
cmd.ActiveConne ction = conn
cmd.CommandText = SQL

set rs = cmd.Execute()

If I set the SQL to something like "SELECT * FROM tbl_test", I always
get an error of "-2147217865" saying "[Microsoft][ODBC SQL Server
Driver][SQL Server] Invalid object name tbl_test". If I set the SQL to
"SELECT * FROM Tester.tbl_test ", everything runs properly. Could anyone
please kindly advise why the first SQL is not working? Or in other
words, why must I prefix the table name with its owner while the DB
connection is already made under that owner name? Thanks in advance.

Tracy

Jul 23 '05
10 21004
Hi

Looks like Tester either owns the database or has sysadmin privileges (which
they probably should not have!). sp_changedbowne r can change the database
ownership, sp_dropsrvrolem ember can be used to remove the login from the
server role.

John

"FreeOperat or" <an******@yahoo .com> wrote in message
news:11******** *************@l 41g2000cwc.goog legroups.com...
Hi Dan and Erland,

Finally got the result of my test script. "SELECT USER" reveals that
the DB user is "dbo" instead of "Tester" although my ODBC connection
string explicitly specifies the user to be "Tester". That's really
weird. Maybe I need to run "SETUSER Tester" directly after the DB
connection is made to make sure the user is correct. Still don't know
what goes wrong there :-(

Thanks,
Tracy

Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5748
by: MyATiX | last post by:
Can someone please tell me why I keep getting the following error? I think it is part of the connection but can't pin down the exact error. I would be grateful if someone might have any ideas. Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E37) Invalid object name 'itemSecUsers'.
2
13905
by: rockie12 | last post by:
I have a db that has a table x in it called data1 I have a program that does to things, updates values in the data1 table and also inserts new rows into this table. The update existing values works great. Then when the insert loop runs, I get this error on the following line. insert into data1 ('AdminManageLogIn','Password') Values ('123','222') Server: Msg 208, Level 16, State 1, Line 1
3
4664
by: Reb | last post by:
Hi, I am using MSSQL server 2000. When i am running my code, i am getting the error System.Data.SqlClient.SqlException: Invalid object name 'Item' where Item is the name of a table. It seems like the code couldn't identify the table. any idea of what could be wrong? thanks
1
2354
by: Frank Py | last post by:
I'm getting the following error when trying an example app: Invalid object name 'Products'. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'Products'. Line 22: myCommand.Fill(ds) Help appreciated. Thanks - Frank <code>
3
3683
by: Mr.KisS | last post by:
Hello all, I'm working with : WinXP PRO SP1, MS SQL 2005 Express, Visual Web Dev 2005 Express. I have an aspx page which must execute a stored procedure : ______________ try { myCommand.ExecuteNonQuery();
2
2692
by: Jerry Nelson | last post by:
I get the following error: WGA_Update is a view not a Table Invalid object name 'WGA_Update'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object
2
6593
by: MrByte | last post by:
Hi Folks, I'm having a strange situation here between 2 Linked MS SQL 2K servers. One of the servers died recently and I rebuilt it. All seems to be working fine, except that when I create views that access tables on the other (linked) server, I can not modify any data, because I get the Invalid object name server.database.dbo.TableName error. The View does work fine otherwise, ie displays the data in it, I just can't modify. The...
3
7418
by: ianforgroupuse | last post by:
I'm running Vista Business edition on 2005 Virtual PC. Installed SQL Server 2005 Express latest download, with instance of MSSQLSERVER and service accounts running under "NT AUTHORITY\SYSTEM". Mixed mode authentication specified and sa password specified. Used server manager to create user login with sysadmin role. Login using windows authentication. Run my application and database is created and populated with default records.
1
1660
by: moni | last post by:
Hi, I am using a table named PersonInfo in my database monisha in the SQL server. I need to use this in a .aspx file , but its giving me the error of invalid object name. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:monishaCS%>" SelectCommand="SELECT , , ,
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.