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
Solved

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

Posted on 2004-08-18
5
336 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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…

860 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