Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 connection problem

Author  Topic 

messi
Starting Member

47 Posts

Posted - 2009-07-15 : 12:25:10
i am having a connection problem

my connection like:



but when i run my pro he gives me this msg:

"Illegal characters in path"

i am using c# 2008 express
sql server 2008 express too

any one help

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-15 : 12:35:01
see

http://www.connectionstrings.com/sql-server-2008
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-07-15 : 13:03:05
Hi Messi,
in c# you either replace all backslashes \ with double back slashes \\

or

You put an @ sign at the start of your connection string

This is the default in c#

However i would advice you put your connection string in your web.config file and reference it as a variable in your classes

here is an example



<connectionStrings>
<add name="afrika" connectionString="Data Source='michaeljackson';Network Library=DBMSSOCN;Initial Catalog=mydatabase;User ID='username';Password='password';" providerName="System.Data.SqlClient" />
</connectionStrings>
Go to Top of Page

messi
Starting Member

47 Posts

Posted - 2009-07-16 : 01:14:36
thanks for replying and help visakh16
and thanks afrika but i am using windows forms not web


Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2009-07-16 : 15:58:14
Oh.
well c# is c#

I have a book on winforms but never really got into it. Use the double slashes or the @ at the start
Go to Top of Page
   

- Advertisement -