Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2004

Tip: Looking for answers? Try searching our database.

Dealing with Spaces in a Database Name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott D - 30 Jul 2004 17:42 GMT
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
but that did not seem to help.  Any suggestions?
Lebrun Thomas - 30 Jul 2004 17:58 GMT
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

> 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
[quoted text clipped - 7 lines]
> with no spaces.  I have tried using single quotes surrounding the name
> but that did not seem to help.  Any suggestions?
mikeb - 30 Jul 2004 18:41 GMT
> 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
[quoted text clipped - 7 lines]
> with no spaces.  I have tried using single quotes surrounding the name
> but that did not seem to help.  Any suggestions?

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.

Signature

mikeb

Glenn Wilson - 03 Aug 2004 11:20 GMT
Try Putting [Around the name]

> 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
[quoted text clipped - 7 lines]
> with no spaces.  I have tried using single quotes surrounding the name
> but that did not seem to help.  Any suggestions?
Scott D - 26 Aug 2004 03:15 GMT
Thanks all the [] worked fine.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.