如何将具有反斜杠的连接字符串传递给SqlConnection? [英] How to pass connection string that has a backward slash to SqlConnection?

查看:102
本文介绍了如何将具有反斜杠的连接字符串传递给SqlConnection?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用C#调用存储过程。

I am trying to call the stored procedure using C#.

我在下一行遇到问题。

SqlConnection("Server=DB2\XPT;DataBase=SCFHP_EDI_P1;Integrated Security=SSPI");

我无法使用的部分是服务器 DB2\ XPT

The part that I am not able to use is the server DB2\XPT.

将服务器名称用作 DB2\XPT

推荐答案

("Server=DB2\\XPT;DataBase=SCFHP_EDI_P1;Integrated Security=SSPI");

(@"Server=DB2\XPT;DataBase=SCFHP_EDI_P1;Integrated Security=SSPI")

这篇关于如何将具有反斜杠的连接字符串传递给SqlConnection?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆