G
Guest
Hi,
I'm currently trying to retrieve information from a specific table within a
SQL Database using the following code:
Dim oSqlCommand As New SqlClient.SqlCommand
oSqlCommand.CommandType = CommandType.Text
oSqlCommand.Connection = mSqlConnection
oSqlcCommand.CommandText = "SELECT * FROM SOMETABLE"
Dim oSqlReader As SqlClient.SqlDataReader
oSqlReader = oSqlCommand.ExecuteReader
oSqlCommand.Dispose()
Connection to the SQL Database is performed like this :
strConnection = "Driver={SQL Server}" & _
";Server=" & mServerName & _
";Database=" & mDatabaseName & _
";Uid=" & mUserID & _
";Pwd=" & mPassword & ";"
mSqlConnection = New SqlClient.SqlConnection(strConnection)
mSqlConnection.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
I'm currently trying to retrieve information from a specific table within a
SQL Database using the following code:
Dim oSqlCommand As New SqlClient.SqlCommand
oSqlCommand.CommandType = CommandType.Text
oSqlCommand.Connection = mSqlConnection
oSqlcCommand.CommandText = "SELECT * FROM SOMETABLE"
Dim oSqlReader As SqlClient.SqlDataReader
oSqlReader = oSqlCommand.ExecuteReader
oSqlCommand.Dispose()
Connection to the SQL Database is performed like this :
strConnection = "Driver={SQL Server}" & _
";Server=" & mServerName & _
";Database=" & mDatabaseName & _
";Uid=" & mUserID & _
";Pwd=" & mPassword & ";"
mSqlConnection = New SqlClient.SqlConnection(strConnection)
mSqlConnection.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