problems when I use local SQL-server

K

kkp40

Hi.
I have a problem when I try to run an application against a local SQL-
server, it works find when I run the application against a SQL-server
on a server.
The problem is this I have 2 databases and some times I have to access
(from the program) SP's that is located in "the other" DB (not the one
I'm connected against).
This is done by setting the name of the DB, owner and SP-name
(MyOtherDB.dbo.sp_name) in an SqlCommand object.
When I run localy I get an exception saying that it can not find
MyOtherDB in systemdatabase but when I run "select * from
sys.databases" I can see MyOtherDB.??

Can anyone tell me what the problem is??
 
V

VJ

one possible reason could be that the user you are using to authenticate to
the local DB does not have access to the "other" DB.

VJ
 
K

kkp40

one possible reason could be that the user you are using to authenticate to
the local DB does not have access to the "other" DB.

VJ







- Visa citerad text -

Thanks VJ.
But it seem that the problem was a space caracter in the beginning of
the original connection string. This is not a problem when I first
connect to the DB but when I later try to run an SP in "the other DB"
an SQL-Helper class don't trim this space away. I did not think to
check the connection string bcs it connectet when I started the app.
But from what I know (and other people told me after I told them the
reason for this error) it is not a problem to have a space character
after the '=' sign and the name of the data base that I have as
Initial catalog.
So as the responsable DBA at my work told me "Thank's MS" for yet
another BUG.
 
M

Marc Gravell

MSDN2 appears (at a cursory glance) to validate your argument
(assuming there are no quotes in hte value)
http://msdn2.microsoft.com/en-us/li...nt.sqlconnection.connectionstring(VS.80).aspx
<q>To include preceding or trailing spaces in the string value, the
value must be enclosed in either single quotation marks or double
quotation marks.</q>

You could log it as a bug, but given there is a simple workaround it
doesn't strike me as very critical - just frustrating for you.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top