Solved

C# not reading backslash in my datasource...please help!

Posted on 2004-08-18
5
307 Views
Last Modified: 2010-04-15
Hello All

I'm having an issue trying to connect my sql databse from my c# app. It's not allowing me to write out my datasource which is DEAN\NETSDK. For some reason it isn't accepting the backslash in the datasource. How do I fix. Thanks

Dean
0
Comment
Question by:dean3740
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
s_sansanwal earned 125 total points
ID: 11837968
try using  DEAN\\NETSDK
or update what is the exact error coming

Cheers
S Sansanwal
0
 

Author Comment

by:dean3740
ID: 11838019
would I need to put quotes around \\? because in vs.net 2003 i'm getting a red underline beneath it.
0
 

Author Comment

by:dean3740
ID: 11838123
Mr. S Sansanwal

Here is my line of code that creates the string i need to access my sql server.

 con= new SqlConnection( "@"  +"Data Source="+FormConfig.DataSource
                          + "\\"
                          +FormConfig.Instance
                          +";Initial Catalog="+FormConfig.InitialCatalog
                          +";Integrated Security ="+FormConfig.IntegratedSecurity);


For some reason its not working, and I'm getting a keyword not supported '@data source' error. What could be the problem?
0
 
LVL 9

Expert Comment

by:s_sansanwal
ID: 11838142
do
 
con= new SqlConnection( @"Data Source="+FormConfig.DataSource
                        + "\\"
                        +FormConfig.Instance
                        +";Initial Catalog="+FormConfig.InitialCatalog
                        +";Integrated Security ="+FormConfig.IntegratedSecurity);

u don't need to have double quotes around @

Cheers,
S Sansanwal
0
 

Author Comment

by:dean3740
ID: 11838174
That worked great. Thanks again.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now