Solved

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

Posted on 2004-08-18
5
347 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Please explain purpose of GZIP 4 83
Need help with another query 10 54
asp.net repeater 2 38
C# DateTime Help 6 46
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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