?
Solved

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

Posted on 2003-12-01
2
Medium Priority
?
229 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
[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
2 Comments
 
LVL 12

Accepted Solution

by:
vascov earned 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 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