OdbcExcetion : Problem with tables access. -
01-06-2005
, 02:37 PM
Hi,
I'm currently trying to retrieve information from a specific table within a
SQL Database using the following code:
Dim oOdbcCommand As New Odbc.OdbcCommand
oOdbcCommand.CommandType = CommandType.Text
oOdbcCommand.Connection = mOdbcConnection
oOdbcCommand.CommandText = "SELECT * FROM SOMETABLE"
Dim oOdbcReader As Odbc.OdbcDataReader
oOdbcReader = oOdbcCommand.ExecuteReader
oOdbcCommand.Dispose()
Connection to the SQL Database is performed like this :
strConnection = "Driver={SQL Server}" & _
";Server=" & mServerName & _
";Database=" & mDatabaseName & _
";Uid=" & mUserID & _
";Pwd=" & mPassword & ";"
mOdbcConnection = New Odbc.OdbcConnection(strConnection)
mOdbcConnection.CreateCommand()
While performing the query with the SOMETABLE owner mUserID, there is no
problem accessing the SOMETABLE information.
Therefore, while performing the query with the Database System Administrator
and DB owner mUserID, I'm unable to access the SOMETABLE information getting
the Invalid Object Name 'SOMETABLE' error message.
If I tried to perform the same thing using EXCEL query, the SOMETABLE
information could be accessed by both mUserID which is not the case with my
application.
It seems that only the SOMETABLE owner could access the table. Why the
Database System Administrator and DB owner could not access the SOMETABLE? Am
I doing something wrong while connecting to the Database? Do I have to change
permissions? Why is it working with EXCEL and not with my application?
Thanks
--
Francois Chouinard |