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

My SQL server has a '\' and this reeks havoc on my C# program...

Posted on 2003-12-01
2
223 Views
Last Modified: 2012-05-04
I get an error when I run this...how do I fool C# to ignore my '\' in the SQLconnection conn = statement...

thanks

<%@ Page Language="C#" Debug="true" %>
<%@ import Namespace="System.Drawing" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">

    private void Page_Load(object sender, System.EventArgs e)
    {
    if (!IsPostBack)
    {
    string name = System.Web.HttpUtility.UrlDecode(Request.QueryString["sqlstring"]);

    SqlConnection conn = new SqlConnection ("server=WWIIS\SQLSERVER;database=data1;uid=joe;pwd=nz6j");


0
Comment
Question by:programmerexchange
2 Comments
 
LVL 12

Accepted Solution

by:
vascov earned 250 total points
ID: 9852780
2 options:
    SqlConnection conn = new SqlConnection ( @"server=WWIIS\SQLSERVER;database=data1;uid=joe;pwd=nz6j");

or

    SqlConnection conn = new SqlConnection ("server=WWIIS\\SQLSERVER;database=data1;uid=joe;pwd=nz6j");

HTH




0
 

Author Comment

by:programmerexchange
ID: 9855724
It was that \\...thanks for the help...was making me crazy and I couldn't find it anywhere...

dk
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

829 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