SqlConnection 构造函数中无法识别的转义序列 [英] Unrecognized escape sequence in SqlConnection constructor
本文介绍了SqlConnection 构造函数中无法识别的转义序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我建立连接时,它都会出错
when ever I make connection it gives an error
无法识别的转义序列.
NEPOLEON\ADMN HERE ON THIS SLASH. NEPOLEON\ADMN IS MY SQL SERVER NAME.
SqlConnection con = new SqlConnection("Server=NEPOLEON\ADMN;Database=MASTER;Trusted_Connection=True");
推荐答案
转义 \ 字符如下:
SqlConnection con = new SqlConnection("Server=NEPOLEON\\ADMN;Database=MASTER;Trusted_Connection=True");
或
SqlConnection con = new SqlConnection(@"Server=NEPOLEON\ADMN;Database=MASTER;Trusted_Connection=True");
这篇关于SqlConnection 构造函数中无法识别的转义序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文