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 10 20983
I likely cause is that your ODBC DSN is setup for integrated security
instead of SQL authentication. The user id in the connection string is then
ignored and the connection is made using Windows authentication. The object
isn't found because the current user isn't 'Tester'.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"FreeOperat or" <an******@yahoo .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . 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
Hi Dan,
Thank you for your kind reply, but I've picked "SQL authentication" for
my system ODBC DSN. I guess It must be something wrong with the user
permission settings in SQL Server 7.0. Just don't know what it is :-(
Thanks,
Tracy
Is your SQL Server configured to allow both SQL Server and Windows? This
will also force Windows authentication instead of SQL auth.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"FreeOperat or" <an******@yahoo .com> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. . Hi Dan,
Thank you for your kind reply, but I've picked "SQL authentication" for my system ODBC DSN. I guess It must be something wrong with the user permission settings in SQL Server 7.0. Just don't know what it is :-(
Thanks, Tracy
FreeOperator (an******@yahoo .com) writes: 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.
In addition to Dan's post, run a "SELECT USER" to see who you really
are.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
Hi Dan,
Thank you again for your kind reply. My SQL Server authentication has
been set to both NT and SQL server, so it shouldn't be a problem ...
Tracy
You might try connecting with Query Analyzer using the Tester login and
running the SELECT USER query Erland suggested.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"FreeOperat or" <an******@yahoo .com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi Dan,
Thank you again for your kind reply. My SQL Server authentication has been set to both NT and SQL server, so it shouldn't be a problem ...
Tracy
Thanks Dan, thanks Erland. "SELECT USER" sounds like a good idea. I'll
implement a test function in my VB DLL to do it. Since the problem
server is hosted by another company and it will take them days
(considering the easter holiday) to update my DLL and run the test for
me. Will let you know the result when I get it.
Thanks again,
Tracy
The VBScript below should provide the same results as your test app as long
as the connection string is the same. Perhaps a script version can expedite
the test.
Dim SQLConn, rs
Set SQLConn = CreateObject("A DODB.Connection ")
SQLConn.Open "DSN=TestDSN;UI D=Tester;PWD=te st"
Set rs = SqlConn.Execute ("SELECT USER")
MsgBox Rs.Fields(0)
rs.Close
SQLConn.Close
--
Hope this helps.
Dan Guzman
SQL Server MVP
"FreeOperat or" <an******@yahoo .com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. . Thanks Dan, thanks Erland. "SELECT USER" sounds like a good idea. I'll implement a test function in my VB DLL to do it. Since the problem server is hosted by another company and it will take them days (considering the easter holiday) to update my DLL and run the test for me. Will let you know the result when I get it.
Thanks again, Tracy
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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'.
|
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...
|
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
|
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>
|
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();
| |
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:...
|
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...
|
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...
|
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 , , ,
|
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...
|
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...
| |
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |