简体   繁体   English

将字符串参数传递给asp.net中的SqlDataSource

[英]Pass string parameter to SqlDataSource in asp.net

i have placed a SqlDataSource component on my aspx page but while configuring the SqlDataSource in the "Test Query" Step I am passing the following parameters : 我已经在aspx页面上放置了一个SqlDataSource组件,但是在“测试查询”步骤中配置SqlDataSource时,我传递了以下参数:

替代文字

But when i click ok it returns following error: 但是,当我单击确定时,它将返回以下错误:

替代文字

This error occurs when i pass the string : 当我传递字符串时,会发生此错误:

INFO, WARN, ERROR, 信息,警告,错误,

I have tried a lot of combinations but nothing works. 我尝试了很多组合,但是没有用。 It works only if i pass one of the three words in single quotes like this : 仅当我将三个单词之一用单引号引起来时,它才起作用:

'ERROR' '错误'

Infact the INFO WARN and ERROR are the various levels available in the table. 实际上,信息警告和错误是表中可用的各种级别。 Each record can have only one level and in the sql query i am using IN("-----") to match the criteria, hope you understand. 每个记录只能有一个级别,在sql查询中,我正在使用IN(“ -----”)来匹配条件,希望您理解。

Any idea to pass the string with comas between them will be highly appreciated. 任何在字符串之间使用逗号分隔的想法将受到高度赞赏。

使用对话助手创建页面后,只需切换到html的代码视图,然后手动在创建的代码上进行更改...

I have resolved the problem by passing each level in single quotes without , after the last level as shown in the image below: 我已经解决了这个问题,如下图所示,在最后一个级别之后,用不带的单引号将每个级别都传递了,而不是:

替代文字

Anyway thanks for your help Aristos! 无论如何,感谢您对亚里士多德的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未提供 asp.net sqldatasource 参数 - asp.net sqldatasource parameter not supplied ASP.NET:SqlDataSource插入-身份参数 - ASP.NET : SqlDataSource insert - identity parameter 将变量传递给SqlDataSource.SelectParameter,然后将查询结果传递给新字符串ASP.NET - Pass variable to SqlDataSource.SelectParameter, then pass query result to new string ASP.NET 将参数添加到sqldatasource,我应该如何传递它们以在ASP.NET中执行我的存储过程 - Adding parameter to sqldatasource, How should i pass them to execute my stored procedure in asp.net 将参数值传递给SqlDataSource ASP.NET User.Identity.Name - Pass parameter value to SqlDataSource ASP.NET User.Identity.Name 将字符串作为参数传递给 ASP.NET 中的视图 - Pass a string as parameter for a View in ASP.NET 从ASP.net应用程序中的SqlDataSource捕获带有参数值的查询字符串 - Catch a query string with parameter values from a SqlDataSource in ASP.net applications 如何在ASP.NET SqlDataSource中处理空的CONTAINS()查询参数? - How to handle empty CONTAINS() query parameter in ASP.NET SqlDataSource? 代码背后的ASP.NET SqlDataSource参数声明 - ASP.NET SqlDataSource parameter declaration in code behind asp.net SqlDataSource FilterExpression空串逻辑 - asp.net SqlDataSource FilterExpression empty string logic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM