PC Review


Reply
Thread Tools Rate Thread

Dealing with Spaces in a Database Name

 
 
Scott D
Guest
Posts: n/a
 
      30th Jul 2004
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?
 
Reply With Quote
 
 
 
 
Lebrun Thomas
Guest
Posts: n/a
 
      30th Jul 2004
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


"Scott D" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?



 
Reply With Quote
 
mikeb
Guest
Posts: n/a
 
      30th Jul 2004
Scott D wrote:
> 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?


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.

--
mikeb
 
Reply With Quote
 
Glenn Wilson
Guest
Posts: n/a
 
      3rd Aug 2004
Try Putting [Around the name]



"Scott D" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?



 
Reply With Quote
 
Scott D
Guest
Posts: n/a
 
      26th Aug 2004
Thanks all the [] worked fine.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fields with exact number of spaces so spaces show in txt file Craig Microsoft Access Queries 1 13th Mar 2009 09:15 PM
how do I remove leading spaces and leave the remianing spaces w =?Utf-8?B?RGViaQ==?= Microsoft Excel Worksheet Functions 6 28th Feb 2007 03:29 PM
Image URL from Database with spaces doesn't work Magnus Blomberg Microsoft ASP .NET 3 12th Apr 2005 04:14 PM
Dealing with spaces in a path name Jim Pockmire Microsoft Access VBA Modules 1 13th Oct 2004 05:13 PM
Dealing with Database Null Rene Microsoft C# .NET 5 18th Aug 2004 04:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 PM.