方法搜索项无重载 [英] No overload for method searchitem
本文介绍了方法搜索项无重载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写此代码进行搜索,但是当我从其他页面编码中调用它时,出现错误方法SearchItem的不重载为" 0"的参数".
I write this code for seaching but i got error "No overload for method SearchItem take ''0'' arguments " when i call it from other page coding.
public DataSet SearchItem(string title, string flag)
{
title =null;
flag =null;
bool @bool = false;
StrQuery = "select * from content ";
if (!string.IsNullOrEmpty(title))
{
StrQuery += " where title like ''%" + title + "%''";
@bool = true;
}
if (!string.IsNullOrEmpty(flag))
{
StrQuery += " " + flag;
}
else
{
StrQuery += " order by contentid asc";
}
return objGenralMothod.ExecuteSelectQur(StrQuery);
}
谢谢...
拉索德·纳伦德拉
[edit]添加了< pre> ...< .pre>标签以保留格式.[/edit]
Thanks ...
Rathod Narendra
[edit]Added <pre>...<.pre> tags to preserve the formatting.[/edit]
推荐答案
您的方法定义是:
Your method definition is:
public DataSet SearchItem(string title, string flag)
即它需要两个参数,两个都为字符串.
当您尝试调用它时,错误消息表示您正在使用:
I.e. it requires two parameters, both string.
When you try to call it, the error message means you are using:
DataSet ds = SearchItem();
即.您没有提供任何参数.
I.e. you have not provided either parameter.
您正在以SearchItem()的形式调用它,它应该是SearchItem("xxx","true")
干杯
You are invoking it as SearchItem(), it should be SearchItem("xxx", "true")
Cheers
几件事.正如格里夫(Griff)所说,这种代码对于人们攻击您的数据库而言已经成熟,真是一团糟.第二件事是,如果您不明白所收到的错误消息的含义,那么在考虑学习SQL之前,您应该专注于学习基本的C#.
A couple of things. As Griff said, this code is ripe for people to attack your database, it''s a mess. The second thing is, if you could not understand the meaning of the error message you got, you should focus on learning basic C# before you consider also learning SQL.
这篇关于方法搜索项无重载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文