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 6894553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:47:49+00:00 2026-05-27T06:47:49+00:00

I am creating a Attendance System and using grid view to insert the data.

  • 0

I am creating a Attendance System and using grid view to insert the data. There may be many rows on the grid. All things are going well and data are also entering well. But I am using a for loop to check each row. This make the performance quite slow when the number of rows increases. And also the round trips increases with the growing number of rows.

Can anyone provide a better solution for this?

I have modify my CODE according to u all…..but now a problem has arise it is only inserting the last row of the grid multiple times……Other than this the Code is fine.

MySqlDataAdapter myworkdatta = myworkdatta = new MySqlDataAdapter("SELECT CID,EID,TID,ATTENDENCE FROM EMPLOYEEATT ORDER BY AID DESC LIMIT 1", conn);
                                    DataSet myworkdsatt = new DataSet();
                                    myworkdatta.Fill(myworkdsatt, "EMPLOYEEATT");

                                    int i;
                                    for (i = 0; i < emplist_gv.Rows.Count; i++)
                                    {
                                        string tid = emplist_gv.Rows[i].Cells[6].Value.ToString();
                                        string eid = emplist_gv.Rows[i].Cells[0].Value.ToString();
                                        string atid = emplist_gv.Rows[i].Cells[7].Value.ToString();

                                        MySqlCommand cmdwk = new MySqlCommand("INSERT INTO EMPLOYEEATT (CID,EID,TID,ATTENDENCE) VALUES (@cid,@eid,@tid,@attendence)", conn);
                                        MySqlParameter spcidatt = new MySqlParameter("@cid", calid);
                                        MySqlParameter speid = new MySqlParameter("@eid", eid);
                                        MySqlParameter sptid = new MySqlParameter("@tid", tid);
                                        MySqlParameter spattendence = new MySqlParameter("@attendence", atid);

                                        cmdwk.Parameters.Add(spcidatt);
                                        cmdwk.Parameters.Add(speid);
                                        cmdwk.Parameters.Add(sptid);
                                        cmdwk.Parameters.Add(spattendence);

                                        myworkdatta.InsertCommand = cmdwk;

                                        DataRow drowk = myworkdsatt.Tables["EMPLOYEEATT"].NewRow();
                                        drowk["CID"] = calid;
                                        drowk["EID"] = eid;
                                        drowk["TID"] = tid;
                                        drowk["ATTENDENCE"] = atid;

                                        myworkdsatt.Tables["EMPLOYEEATT"].Rows.Add(drowk);

                                    }

                                    myworkdatta.Update(myworkdsatt, "EMPLOYEEATT");
  • 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-27T06:47:50+00:00Added an answer on May 27, 2026 at 6:47 am

    Considering your 2 select SQL statement doesn’t seem to contain anything relevant to the the specific row you can take that out of the loop and just use its values easy enough.

    Because you need to do an insert on each row, which I don’t understand why, then it seems hard to remove the database hits there.

    If you are doing a bulk insert you could look at bulk inserts for MySql: MySql Bulk insert

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

Sidebar

Related Questions

Creating sprite sheets aka texture atlases rather than using many hundres of individual images
Creating My Windows Form Application and using ADO.Net as Data Access layer and SQL
Creating the View and View Model Using Unity Using Unity as your dependency injection
I'm creating a feedback system kind of like eBay. (Once you buy the item
Creating a table without tbody using javascript createElement/appendChild will not add tbody in Firebug
Creating a site in with FrogCMS and using alot of jquery to create an
Creating a login system for something and am getting: Warning: mysql_result(): supplied argument is
When creating form elements with Zend (using Zend Studio for Eclipse), I'd like some
Creating an Iphone application, I used to perform INSERT QUERY on different databases. But
Creating Facebook event for specific page with FB Graph API There is a thread

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.