Groups | Blog | Home
all groups > dotnet framework > july 2004 >

dotnet framework : Dealing with Spaces in a Database Name


sdavenport NO[at]SPAM sigcom.net
7/30/2004 9:42:00 AM
I have a third party application that has a SQL database I am trying
to work with this in my code but the database name has a space in it
so when I try the following connection string:

Dim connString As String = "server=10.0.0.1;uid=sa;pwd=;Initial
Catalog=Third Party"

I assume it is cutting the name off at "Third". I have no control
over the databases name otherwise I would just have named it correctly
with no spaces. I have tried using single quotes surrounding the name
mikeb
7/30/2004 10:41:23 AM
[quoted text, click to view]

Are you using the SqlConnection object, or some other data provider?

I have no problems with an Initial Catalog that contains spaces in the
name. That includes with or without putting the database name in single
quotes (it works either way).

If you're using VS.NET, use the Server Explorer to connect to the
database - you can use the connection string it generates (after
removing a few items that the ADO.NET SQL server provider does not
support).

If Server Explorer can't connect to the database, then you can
troubleshoot from there.

I'm using .NET Framework 1.1 and SQL Server 2000.

--
Lebrun Thomas
7/30/2004 6:58:59 PM
Maybe you can try


Dim connString As String = "server=10.0.0.1;uid=sa;pwd=;Initial
Catalog='Third Party'"

Bye.

--
LEBRUN Thomas
http://morpheus.developpez.com


[quoted text, click to view]

Glenn Wilson
8/3/2004 8:20:06 PM
Try Putting [Around the name]



[quoted text, click to view]

sdavenport NO[at]SPAM sigcom.net
8/25/2004 7:15:08 PM
AddThis Social Bookmark Button