Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6021839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:46:18+00:00 2026-05-23T03:46:18+00:00

I am updating the data by the following method class xxxxxx { public static

  • 0

I am updating the data by the following method

class xxxxxx
{
    public static string updatepersonformData(string staffID, string Firstname, string Lastname, string Address1,
        string Address2,string Address3, string Town, string County, string Postcode, string HomePhone, string Mobile,
        string PersonalEmail, string Reference, string BookingName, string Position_Id, string Role_Id, string Gender,
        string Dob, string WorkPhone, string WorkEmail, formMain mf)
    {
        string result = xxxxxx.InsertData(string.Format(@"update staff set staff_Reference='{2}' staff_Firstname = '{3}',staff_Lastname='{4}' ,
              staffPosition_Id='{5}',staffRole_Id='{6}', staff_Dob='{7}',staff_Gender='{8}' staff_Address1 = '{9}',   
             staff_Address2='{10}',staff_Address3 ='{11}' staff_Town ='{12}',staff_County = '{13}',staff_Postcode='{14}',staff_HomePhone='{16}',
             staff_WorkPhone ='{17}',staff_Mobile ='{18}',staff_PersonalEmail ='{19}',staff_WorkEmail='{20}',staff_BookingName='{21}',WHERE staff_Id ={0}",
            staffID, Reference, Firstname, Lastname, Position_Id, Role_Id, Dob, Gender, Address1, Address2, Address3, Town, County, Postcode, HomePhone, WorkPhone,
            Mobile, PersonalEmail, WorkEmail, BookingName), mf);

        return result;
    }
}

I am calling this function in main form by using this below

xxxxxx.updatepersonformData(tbCStaffHiddenId.Text, tbFirstname.Text, tbLastname.Text,    tbAddress1.Text, tbAddress2.Text, tbAddress3.Text, tbTown.Text,
              tbCounty.Text, tbPostcode.Text, tbHomePhone.Text, tbMobile.Text, tbPersonalEmail.Text, tbReference.Text, tbBookingName.Text, selectTextToId(cbPosition, aaPositions),
              selectTextToId(cbRole, aaRoles), cbGender.Text, tbDob.Text.ToString(), tbWorkPhone.Text, tbWorkEmail.Text, mf);

But when I am updating this one I got the error like this……

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

Make sure your method arguments are in
right form.

When converting a string to date time,
parse the string to take the date
before putting each variable into the
date time object.

Can anyone help on this …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:46:19+00:00Added an answer on May 23, 2026 at 3:46 am

    You’re passing 20 arguments to string.Format, but your format placehorlders go from 0 to 21 (so presumably you need 22 arguments, or you’ve misindexed the thing – e.g. I don’t see a {15} in there). Recheck your string and arguments until that formatting error is resolved.

    And you have a syntax error in your query. The should not be a , before the WHERE keyword.

    (And please use bind variables if they are available on whatever system/language it is you are using, and sanitize your data, otherwise bad things will happen – google for “sql injection”.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using the following method for all data inserting and updating processes in my
Following error occurs while updating a particular data in my web application.I am using
I've the following BLL class, which provides tools for adding, updating and deleting elements
Can anyone help me regarding updating data in the gridview by using AJAX? Once
I'm using an IntentService to perform background tasks, such as updating data from a
I am using MySql and SQLLITE in my application. When Inserting data or updating
How can you go about updating a record without having to select the data
I have a query that strips data from a XML string, inserts it into
I have the following data structure : +---------+ |Resume | +---------+ |Id (PK) |
Using Bootstrap 2.0 I've styled a table using .table-striped. I'm updating rows of data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.