System.ArgumentException: 不支持关键字: "integratedsecurity".
行39:publicDataSetGetDataTableBySql(StringSqlStr)行40:{行41:Con.ConnectionString=GetConn...
行 39: public DataSet GetDataTableBySql(String SqlStr)
行 40: {
行 41: Con.ConnectionString = GetConnectionString();
行 42: Com.Connection = Con;
行 43: Com.CommandText = SqlStr;
[ArgumentException: 不支持关键字: “integratedsecurity”。]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +4907780
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +55
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
DB.GetDataTableBySql(String SqlStr) in e:\vs2008\App_Code\DB.cs:41
xs_xs_login.btn_Login_Click(Object sender, EventArgs e) in e:\vs2008\xs\xs\login.aspx.cs:37
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 展开
行 40: {
行 41: Con.ConnectionString = GetConnectionString();
行 42: Com.Connection = Con;
行 43: Com.CommandText = SqlStr;
[ArgumentException: 不支持关键字: “integratedsecurity”。]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +4907780
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +55
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +200
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +62
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
DB.GetDataTableBySql(String SqlStr) in e:\vs2008\App_Code\DB.cs:41
xs_xs_login.btn_Login_Click(Object sender, EventArgs e) in e:\vs2008\xs\xs\login.aspx.cs:37
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 展开
1个回答
展开全部
楼上的这位你干过C#没?
那上面写的很清楚,string userid=....你还问userid是怎么定义的,这明显不是数据类型的事,
我觉得是你这句有问题:
string sql = "select UserName from Users where UserID='0'";
应该是:
string sql = "select UserName from Users where UserID={0}";
这样吧。占位符。可以试试看,如果userid在数据库里不是数字,那就
string sql = "select UserName from Users where UserID='{0}'";试试。
实在不行就不要用占位符了 直接拼串:
string sql = "select UserName from Users where UserID="+userid;
那上面写的很清楚,string userid=....你还问userid是怎么定义的,这明显不是数据类型的事,
我觉得是你这句有问题:
string sql = "select UserName from Users where UserID='0'";
应该是:
string sql = "select UserName from Users where UserID={0}";
这样吧。占位符。可以试试看,如果userid在数据库里不是数字,那就
string sql = "select UserName from Users where UserID='{0}'";试试。
实在不行就不要用占位符了 直接拼串:
string sql = "select UserName from Users where UserID="+userid;
Storm代理
2023-08-29 广告
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |