>>if you specify a default value for each parameter, will it work then?
No luck, any ideas?
Main Topics
Browse All TopicsI got this:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:connstri
ProviderName="MySql.Data.M
SelectCommandType="StoredP
<SelectParameters>
<asp:Parameter DefaultValue="" Name="_id" ConvertEmptyStringToNull="
<asp:Parameter DefaultValue="" Name="_filecourse_id"
ConvertEmptyStringToNull="
<asp:Parameter DefaultValue="" Name="_keyword"
ConvertEmptyStringToNull="
<asp:Parameter DefaultValue="" Name="_isactive"
ConvertEmptyStringToNull="
</SelectParameters>
</asp:SqlDataSource>
CREATE PROCEDURE `myproc`(
in _id varchar(20),
in _filecourse_id varchar(20),
in _keyword varchar (100),
in _isactive varchar(1)
)
BEGIN
Set @sql = "Select * from myproc ";
Set @where = " Where ";
if _id<>"" then
Set @where = CONCAT(@where, " id = ",_id," and ");
end if;
if _filecourse_id<>"" then
Set @where = CONCAT(@where, " filecourse_id = ",_filecourse_id," and ");
end if;
if _keyword<>"" then
Set @where = CONCAT(@where, " (title like '%",_keyword,"%' or filepath like '%",_keyword,"%') and ");
end if;
if _isactive<>"" then
Set @where = CONCAT(@where, " isactive = ",_isactive," and ");
end if;
if @where<> " Where " then
Set @where = SUBSTRING(@where,1,length(
Set @sql = CONCAT(@sql, @where);
end if;
PREPARE s1 FROM @sql;
EXECUTE s1;
DEALLOCATE PREPARE s1;
END $$
DELIMITER ;
Obviously there are 4 parameters for the procedures, but why everytime I run my script, I got error:
>>Incorrect number of arguments for PROCEDURE myproc; expected 4, got 3
If I doing my debugging in Watch window:
SqlDataSource1.SelectParam
So weird, I can't get the clue! Any idea to resolve this?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Now even I add the SelectParameters from scripts, I will get same error of:
>>Incorrect number of arguments for PROCEDURE myproc; expected 4, got 3
always got "3"!!
SqlDataSource1.SelectParam
SqlDataSource1.SelectParam
SqlDataSource1.SelectParam
SqlDataSource1.SelectParam
SqlDataSource1.SelectParam
Hi again,
Not sure whether it will make any difference but it could be worth specifying the parameter direction if you haven't already tried that, i.e.:
<asp:Parameter DefaultValue="" Name="_id" ConvertEmptyStringToNull="
<asp:Parameter DefaultValue="" Name="_filecourse_id" ConvertEmptyStringToNull="
<asp:Parameter DefaultValue="" Name="_keyword" ConvertEmptyStringToNull="
<asp:Parameter DefaultValue="" Name="_isactive" ConvertEmptyStringToNull="
/Carl.
I ended up with solution like this:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:connstri
ProviderName="<%$ ConnectionStrings:connstri
SelectCommand="call myprod(?_id,?_filecourse_i
>
<SelectParameters>
<asp:Parameter Name="?_id" DefaultValue="" Direction="Input" Type="String" ConvertEmptyStringToNull="
<asp:Parameter Name="?_filecourse_id" DefaultValue="" Direction="Input" Type="String" ConvertEmptyStringToNull="
<asp:Parameter Name="?_keyword" DefaultValue="" Direction="Input" Type="String" ConvertEmptyStringToNull="
<asp:Parameter Name="?_isactive" DefaultValue="" Direction="Input" Type="String" ConvertEmptyStringToNull="
</SelectParameters>
</asp:SqlDataSource>
but this doesn't resolved my original question.
Business Accounts
Answer for Membership
by: carlnorrbomPosted on 2009-02-12 at 02:35:45ID: 23620676
Hi,
ters.Count = 4 since You have specified 4 select parameters. What You need to verify I guess is that all parameters are getting populated with a value? Just for fun, if you specify a default value for each parameter, will it work then?
Well, you should always get: SqlDatSource1.SelectParame
/Carl.