Multiple Table Update using Stored Procedure in ASP.NET -
i'm getting following error:
"procedure or function 'usp_update_customer_contact_form has many arguments specified"
i have read lot of post regarding topic , implemented many of fixes
i'm still seeing same error. can please me out?
i have form updates 3 separate tables when update button selected. have chosen perform operation using store procedure in sql database
. stored procedure , asp form code.
any appreciated!
thanks! kelly
sql stored procedure:
alter procedure [dbo].[usp_update_customer_contact_form] @customer_id int, @customer_first_name varchar(150), @customer_middle_name varchar(150), @customer_last_name varchar(150), @customer_ad_source_id int, @customer_current_control_id int, @customer_current_status_id int, @customer_current_progress_id int, @customer_initial_contact_type_id int, @customer_store_id int, @customer_bdc_rep_id int, @address_line_1 varchar(150), @address_city varchar(150), @address_state varchar(150), @address_zip_code varchar(150), @phone_number varchar(30), @phone_number_2 varchar(30), @phone_number_3 varchar(30) begin update customer set customer_first_name = @customer_first_name, customer_middle_name = @customer_middle_name, customer_last_name = @customer_last_name, customer_ad_source_id = @customer_ad_source_id, customer_current_control_id = @customer_current_control_id, customer_current_status_id = @customer_current_status_id, customer_current_progress_id = @customer_current_progress_id, customer_initial_contact_type_id = @customer_initial_contact_type_id, customer_store_id = @customer_store_id, customer_bdc_rep_id = @customer_ad_source_id customer_id = @customer_id; update customer_address set address_line_1 = @address_line_1, address_city = @address_city, address_state = @address_state, address_zip_code = @address_zip_code address_customer_id = @customer_id , address_seq_number = (select max(b.address_seq_number) customer_address b b.address_customer_id = address_customer_id); update customer_phone set phone_number = @phone_number, phone_number_2 = @phone_number_2, phone_number_3 = @phone_number_3 phone_customer_id = @customer_id , phone_seq_number = (select max(b.phone_seq_number) customer_phone b b.phone_customer_id = phone_customer_id); end
aspx form code:
<asp:formview id="customer_contact_info" runat="server" datasourceid="ds_customer_contact1" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#1f497d" style="margin-left: 1px; margin-bottom: 1px; margin-top: 0px;" width="1000px" defaultmode="edit" datakeynames="customer_id" height="268px" editrowstyle-verticalalign="top"> <edititemtemplate> customer: <asp:label id="label3" runat="server" enabled="false" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#0070c0" text='<%# bind("customer_number", "{0}") %>'></asp:label> <asp:textbox id="customer_first_name" runat="server" autocompletetype="firstname" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("customer_first_name", "{0}")%>' width="100px" causesvalidation="true" /> <asp:textbox id="customer_middle_name" runat="server" autocompletetype="middlename" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("customer_middle_name", "{0}")%>' width="75px" causesvalidation="true" /> <asp:textbox id="customer_last_name" runat="server" autocompletetype="lastname" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("customer_last_name", "{0}")%>' width="100px" causesvalidation="true" wrap="false" /> phone: <asp:textbox id="phone_numbertextbox" runat="server" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#0070c0" text='<%# bind("phone_number", "{0}")%>' width="100px" font-underline="true" /> <asp:textbox id="phone_alt1_numbertextbox" runat="server" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#0070c0" text='<%# bind("phone_number_2", "{0}")%>' width="100px" font-underline="true" /> <asp:textbox id="phone_alt2_numbertextbox" runat="server" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#0070c0" text='<%# bind("phone_number_3", "{0}")%>' width="100px" font-underline="true" /> <br /> address: <asp:textbox id="address_line_1" runat="server" autocompletetype="homestreetaddress" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("address_line_1", "{0}")%>' width="283px" /> <asp:textbox id="address_city" runat="server" autocompletetype="homecity" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("address_city", "{0}")%>' /> <asp:textbox id="statetextbox" runat="server" autocompletetype="homestate" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("address_state", "{0}")%>' width="25px" /> <asp:textbox id="zipcodetextbox" runat="server" autocompletetype="homezipcode" autopostback="true" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" text='<%# bind("address_zip_code", "{0}")%>' width="73px" /> <asp:label id="label4" runat="server" text='<%# bind("customer_id")%>' visible="false"></asp:label> <hr align="left" noshade="noshade" size="2" style="border-color: #1f497d; color: #1f497d" width="1000" /><span class="style2">status: </span> <asp:radiobuttonlist id="status_radio_button" runat="server" cssclass="visibility:hidden" datasourceid="ds_val_status_type_table" datatextfield="val_status_desc" datavaluefield="val_status_id" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#a6a6a6" repeatdirection="horizontal" repeatlayout="flow" selectedvalue='<%# bind("customer_current_status_id", "{0}")%>' enabled="false" height="25px"> </asp:radiobuttonlist> <asp:sqldatasource id="ds_val_status_type_table" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select distinct * [val_status] order [val_status_sort_order]"></asp:sqldatasource> <span class="style2"> <br /> progress: </span> <asp:radiobuttonlist id="progress_radio_button" runat="server" datasourceid="ds_val_progress_table" datatextfield="val_progress_desc" datavaluefield="val_progress_id" enabled="false" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#a6a6a6" repeatdirection="horizontal" repeatlayout="flow" selectedvalue='<%# bind("customer_current_progress_id", "{0}")%>' height="25px"> </asp:radiobuttonlist> <asp:sqldatasource id="ds_val_progress_table" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select distinct * [val_progress] order [val_progress_sort_order]"></asp:sqldatasource> <hr align="left" noshade="noshade" size="2" style="border-color: #1f497d; color: #1f497d" width="1000" /> <span class="style2">control: </span> <asp:radiobuttonlist id="control_radio_button" runat="server" autopostback="true" datasourceid="ds_val_control_table" datatextfield="val_control_desc" datavaluefield="val_control_id" enabled="false" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#a6a6a6" repeatdirection="horizontal" repeatlayout="flow" selectedvalue='<%# bind("customer_current_control_id", "{0}")%>'> </asp:radiobuttonlist> <asp:label id="label1" runat="server" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#1f497d" text="bdc rep:"></asp:label> <asp:dropdownlist id="dropdownlist1" runat="server" autodsfpostback="true" datasourceid="ds_bdc_drop_down_validation" datatextfield="emp_full_name" datavaluefield="emp_id" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" selectedvalue='<%# bind("customer_bdc_rep_id", "{0}")%>' width="200px"> </asp:dropdownlist> <asp:sqldatasource id="ds_bdc_drop_down_validation" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select deal_user_id emp_id, deal_user_first_name + ' ' + deal_user_last_name emp_full_name, deal_user_first_name emp_first, deal_user_last_name emp_last admin_employee_user order deal_user_first_name, deal_user_last_name"></asp:sqldatasource> <asp:label id="label2" runat="server" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#1f497d" text="store: "></asp:label> <asp:dropdownlist id="dropdownlist2" runat="server" autodsfpostback="true" cssclass="hidearrow" datasourceid="ds_store_drop_down_validation" datatextfield="val_store_location" datavaluefield="val_store_id" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" selectedvalue='<%# bind("customer_store_id", "{0}")%>' width="200px"> </asp:dropdownlist> <asp:sqldatasource id="ds_store_drop_down_validation" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select [val_store_id], [val_store_location] [val_store] order [val_store_location]"></asp:sqldatasource> <asp:sqldatasource id="ds_val_control_table" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select distinct * [val_control] order [val_control_sort_order]"></asp:sqldatasource> <hr align="left" noshade="noshade" size="2" style="border-color: #1f497d; color: #1f497d" width="1000" /> <span class="style2">initial contact: </span> <asp:radiobuttonlist id="initial_contact_radio_button" runat="server" autopostback="true" datasourceid="ds_val_initial_contatct_table" datatextfield="val_initial_contact_desc" datavaluefield="val_initial_contact_id" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" repeatdirection="horizontal" repeatlayout="flow" selectedvalue='<%# bind("customer_initial_contact_type_id", "{0}")%>' height="25px"> </asp:radiobuttonlist> <asp:sqldatasource id="ds_val_initial_contatct_table" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select * [val_initial_contact] order [val_initial_contact_desc]"></asp:sqldatasource> <span class="style2"> <br /> ad source: </span> <asp:radiobuttonlist id="status_radio_button0" runat="server" autopostback="true" datasourceid="ds_val_ad_source_table" datatextfield="val_ad_source_desc" datavaluefield="val_ad_source_id" font-bold="true" font-names="calibri" font-size="12pt" font-underline="true" forecolor="#0070c0" repeatdirection="horizontal" repeatlayout="flow" selectedvalue='<%# bind("customer_ad_source_id", "{0}")%>' height="25px"> </asp:radiobuttonlist> <hr align="left" noshade="noshade" size="2" style="border-color: #1f497d; color: #1f497d" width="1000" /> <asp:sqldatasource id="ds_val_ad_source_table" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select * [val_ad_source] order [val_ad_source_desc]"></asp:sqldatasource> <asp:panel id="panel1" runat="server" style="text-align: center" width="1000px"> <asp:button id="button3" runat="server" commandname="update" text="update" backcolor="white" bordercolor="#1f497d" borderstyle="solid" borderwidth="2px" cssclass="static" font-bold="true" font-names="calibri" font-size="12pt" forecolor="#1f497d" commandargument="usp_update_customer_contact_form" postbackurl="~/customer_contact.aspx" /> </asp:panel> </edititemtemplate> <editrowstyle verticalalign="top"></editrowstyle> </asp:formview> <asp:sqldatasource id="ds_customer_contact1" runat="server" connectionstring="<%$ connectionstrings:ds_freedomridesconnect %>" selectcommand="select max(customer.customer_id) customer_id, max(customer.customer_number) customer_number, max(customer.customer_first_name) + ' ' + max(customer.customer_middle_name) + ' ' + max(customer.customer_last_name) customer_name, max(customer.customer_first_name) customer_first_name, max(customer.customer_middle_name) customer_middle_name, max(customer.customer_last_name) customer_last_name, max(customer_phone.phone_number) phone_number, max(case when address_line_1 not null , address_city not null , address_state not null , address_zip_code not null address_line_1 + ', ' + address_city + ', ' + address_state + ', ' + address_zip_code end) full_address, customer_address.address_line_1, customer_address.address_city, customer_address.address_state, customer_address.address_zip_code, max(customer_phone.phone_id) expr1, max(customer_address.address_id) expr2, customer_phone.phone_number_2, customer_phone.phone_number_3, customer_phone.phone_active_ind, customer_address.address_active_ind, max(customer.customer_ad_source_id) customer_ad_source_id, max(customer.customer_current_control_id) customer_current_control_id, max(customer.customer_current_status_id) customer_current_status_id, max(customer.customer_current_progress_id) customer_current_progress_id, max(customer.customer_initial_contact_type_id) customer_initial_contact_type_id, max(customer.customer_store_id) customer_store_id, max(customer.customer_bdc_rep_id) customer_bdc_rep_id customer left outer join customer_phone on customer_phone.phone_customer_id = customer.customer_id , customer_phone.phone_active_ind = 'y' left outer join customer_address on customer_address.address_customer_id = customer.customer_id , customer_address.address_active_ind = 'y' group customer.customer_id, customer_address.address_line_1, customer_address.address_city, customer_address.address_state, customer_address.address_zip_code, customer_phone.phone_number_2, customer_phone.phone_number_3, customer_phone.phone_active_ind, customer_address.address_active_ind having (customer.customer_id = @cust_id) , (customer_phone.phone_active_ind = n'y') , (customer_address.address_active_ind = n'y')" updatecommand="usp_update_customer_contact_form" updatecommandtype="storedprocedure"> <selectparameters> <asp:formparameter defaultvalue="100003" formfield="cust_id" name="cust_id" /> </selectparameters> <updateparameters> <%-- <asp:parameter name="customer_id" type="int32" />--%> <asp:parameter direction="input" name="customer_id" type="int32" /> <asp:parameter direction="input" name="customer_first_name" type="string" /> <asp:parameter direction="input" name="customer_middle_name" type="string" /> <asp:parameter direction="input" name="customer_last_name" type="string" /> <asp:parameter direction="input" name="customer_ad_source_id" type="int32" /> <asp:parameter direction="input" name="customer_current_control_id" type="int32" /> <asp:parameter direction="input" name="customer_current_status_id" type="int32" /> <asp:parameter direction="input" name="customer_current_progress_id" type="int32" /> <asp:parameter direction="input" name="customer_initial_contact_type_id" type="int32" /> <asp:parameter direction="input" name="customer_store_id" type="int32" /> <asp:parameter direction="input" name="customer_bdc_rep_id" type="int32" /> <asp:parameter direction="input" name="address_line_1" type="string" /> <asp:parameter direction="input" name="address_city" type="string" /> <asp:parameter direction="input" name="address_state" type="string" /> <asp:parameter direction="input" name="address_zip_code" type="string" /> <asp:parameter direction="input" name="phone_number" type="string" /> <asp:parameter direction="input" name="phone_number_2" type="string" /> <asp:parameter direction="input" name="phone_number_3" type="string" /> </updateparameters> </asp:sqldatasource>
this error occurring fact parameters passed stored procedure upon execution (exec usp_update_customer_contact_form
) not same number number of parameters in stored procedure parameter list. because different, error occurs. that's error entails.
Comments
Post a Comment