Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-18
5
Medium Priority
?
352 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 500 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

705 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