-5

I am getting error on following lines of code...plz help.

Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

    string order1= string.Format ("exec a_add_user '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}'",TextBox_first_name.Text ,TextBox_last_name.Text ,TextBox_user_name.Text ,TextBox_password.Text ,DropDownList_telephone_code.SelectedValue  +TextBox_telephone_no.Text ,DropDownList_mobile_code.SelectedValue +TextBox_mobile_no.Text ,RadioButtonList_gender.SelectedValue ,DropDownList_country.SelectedValue ,DropDownList_city.SelectedValue ,TextBox_address.Text);
3
  • Learn to use a debugger. This is not a suitable question for SO. Commented Mar 26, 2014 at 22:13
  • This question has enough informations to diagnose the problem and it can be reproduced even if it's not a good question since it has many duplicates ( such as ). Commented Mar 26, 2014 at 22:17
  • You are passing 10 arguments but try to access {10} which, is zero based, argument 11. Commented Mar 26, 2014 at 22:31

1 Answer 1

2

You're specifying 11 format items but have 10 strings you're trying to append.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.