Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-12-01
2
Medium Priority
?
231 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 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