Hi:
I have a vb 6 app that exports data from sql to excel. The user has the ability to select either local or server. When they select server, the connection string is modified to include the server name instead of the local msde instance to look like this:
"provider=sqloledb;data source=MyServer;initial catalog=MyDatabase;user id=UserX;password=PasswordX;database=MyDatabase"
I'm using Microsoft Jet Provider 4.0 and OpenDataSource.
SELECT * INTO TempXL FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\test\xltest.xls;Extended Properties=Excel 8.0')...[Sheet1$]
This code works fine when user is accessing msde on local, but when using above DSN, I receive the following message:
"2147217900 - OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEdB.4.0' IDBInitialize:: Initialize returned 0x800040005: The provider did not give any information about the error.]
When I trace the connection, these error messages occur:
Failed to set proper user name ('NT AUTHORITY\SYSTEM') for the connection
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot alter table 'TblXMyTable' because this table does not exist in database 'master'. (State 42S02) (Code 4902)
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'TblxMytable'. (State 42S02) (Code 208)
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error. (State 42000) (Code 7399)
[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.]. (State 01000) (Code 7300)
I am especially puzzled by the second message because I am specifying the database name in my connection string as:
"provider=sqloledb;data source=MyServer;initial catalog=MyDatabase;user id=UserX;password=PasswordX;database=MyDatabase"
I can read from the server copy and copy to Excel, but I cannot write back to SQL. Can someone please tell me what I'm doing wrong?
Thanks in advance for any help.,
I had a problem similar to this when working with VB6, DAO, ADO and SQL Server 2005.
One user could do a query, another user could not.
In fact, the error message was similar to yours. The error message claimed that the table we were trying to query did NOT EXIST.
So, I believe your problem lies with Security.
Try making the user a database owner of the database in question. If this solves your problem, then you can look for a way to set the permission/security correctly for the specifc tables they need access to.
No comments:
Post a Comment