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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:10:28+00:00 2026-05-15T19:10:28+00:00

i try to add data with ExecuteCommand. everything is ok if list<string> data. i

  • 0

i try to add data with ExecuteCommand. everything is ok if list<string> data. i converted string type list into arraylist to add sql. But <MyClass> there are rows and column. look below picture.

  public class MyTally :  ISave
    {
        public List<ENG_MPD> engMpdIntersectList { get; set; }
        private ArrayList engMyTallyList;
        private EngDataContext engCtx;
        public MyTally()
        {
            engCtx = new EngDataContext();
            engMpdIntersectList = new List<ENG_MPD>();

        }
       #region ISave Members

        public bool Save()
        {

            engMyTallyList = new ArrayList(engMpdIntersectList);
            System.Windows.Forms.MessageBox.Show(engMyTallyList.Count.ToString());


              int rowsAffected = engCtx.ExecuteCommand("insert into ENG_MYTALLY Values({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20}," +
                                                                                 "{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},{38},{39},{40}," +
                                                                                 "{41},{42},{43},{44},{45},{46},{47},{48},{49},{50},{51},{52},{53},{54},{55},{56},{57},{58},{59},{60}," +
                                                                                 "{61},{62},{63},{64},{65},{66},{67},{68},{69},{70},{71},{72},{73},{74},{75},{76},{77},{78},{79},{80}," +
                                                                                 "{81},{82},{83},{84},{85},{86},{87},{88},{89},{90},{91},{92},{93},{94},{95},{96},{97},{98},{99},{100}," +
                                                                                 "{101},{102},{103},{104},{105},{106},{107},{108},{109},{110},{111},{112},{113},{114},{115},{116},{117},{118},{119},{120}," +
                                                                                 "{121},{122},{123},{124},{125},{126},{127},{128},{129},{130},{131},{132},{133},{134},{135},{136})",
                                                                                 engMyTallyList[0], engMyTallyList[1], engMyTallyList[2], engMyTallyList[3], engMyTallyList[4], engMyTallyList[5], engMyTallyList[6], engMyTallyList[7], engMyTallyList[8], engMyTallyList[9], engMyTallyList[10], engMyTallyList[11], engMyTallyList[12], engMyTallyList[13], engMyTallyList[14], engMyTallyList[15], engMyTallyList[16], engMyTallyList[17], engMyTallyList[18], engMyTallyList[19], engMyTallyList[20],
                                                                                 engMyTallyList[21], engMyTallyList[22], engMyTallyList[23], engMyTallyList[24], engMyTallyList[25], engMyTallyList[26], engMyTallyList[27], engMyTallyList[28], engMyTallyList[29], engMyTallyList[30], engMyTallyList[31], engMyTallyList[32], engMyTallyList[33], engMyTallyList[34], engMyTallyList[35], engMyTallyList[36], engMyTallyList[37], engMyTallyList[38], engMyTallyList[39], engMyTallyList[40],
                                                                                 engMyTallyList[41], engMyTallyList[42], engMyTallyList[43], engMyTallyList[44], engMyTallyList[45], engMyTallyList[46], engMyTallyList[47], engMyTallyList[48], engMyTallyList[49], engMyTallyList[50], engMyTallyList[51], engMyTallyList[52], engMyTallyList[53], engMyTallyList[54], engMyTallyList[55], engMyTallyList[56], engMyTallyList[57], engMyTallyList[58], engMyTallyList[59], engMyTallyList[60],
                                                                                 engMyTallyList[61], engMyTallyList[62], engMyTallyList[63], engMyTallyList[64], engMyTallyList[65], engMyTallyList[66], engMyTallyList[67], engMyTallyList[68], engMyTallyList[69], engMyTallyList[70], engMyTallyList[71], engMyTallyList[72], engMyTallyList[73], engMyTallyList[74], engMyTallyList[75], engMyTallyList[76], engMyTallyList[77], engMyTallyList[78], engMyTallyList[79], engMyTallyList[80],
                                                                                 engMyTallyList[81], engMyTallyList[82], engMyTallyList[83], engMyTallyList[84], engMyTallyList[85], engMyTallyList[86], engMyTallyList[87], engMyTallyList[88], engMyTallyList[89], engMyTallyList[90], engMyTallyList[91], engMyTallyList[92], engMyTallyList[93], engMyTallyList[94], engMyTallyList[95], engMyTallyList[96], engMyTallyList[97], engMyTallyList[98], engMyTallyList[99], engMyTallyList[100],
                                                                                 engMyTallyList[101], engMyTallyList[102], engMyTallyList[103], engMyTallyList[104], engMyTallyList[105], engMyTallyList[106], engMyTallyList[107], engMyTallyList[108], engMyTallyList[109], engMyTallyList[110], engMyTallyList[111], engMyTallyList[112], engMyTallyList[113], engMyTallyList[114], engMyTallyList[115], engMyTallyList[116], engMyTallyList[117], engMyTallyList[118], engMyTallyList[119], engMyTallyList[120],
                                                                                 engMyTallyList[121], engMyTallyList[122], engMyTallyList[123], engMyTallyList[124], engMyTallyList[125], engMyTallyList[126], engMyTallyList[127], engMyTallyList[128], engMyTallyList[129], engMyTallyList[130], engMyTallyList[131], engMyTallyList[132], engMyTallyList[133], engMyTallyList[134], engMyTallyList[135], engMyTallyList[136]);
             return rowsAffected > 0;
        }

        #endregion
    }

alt text

 engMyTallyList = new ArrayList(engMpdIntersectList);

engMpdIntersectList is an instance from myClass… how can i use it? my Arraylist values ENG_MPD type i need ENG_MPD columns values…

  • 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-15T19:10:29+00:00Added an answer on May 15, 2026 at 7:10 pm
    engCtx.ExecuteCommand("insert into ENG_MYTALLY Values({0})", 
        string.Join(", ", engMyTallyList.Select(x => x.ToString()).ToArray())
    );
    

    Instead of x.ToString() you can call whatever method or property you like that returns string.
    If engMyTallyList is not generic, you will need to cast it before using Select.

    engMyTallyList.Cast<MyTally>().Select(x => x.ToString()).ToArray()
    

    Edit:
    You don’t have to convert from List<ENG_MPD> to ArrayList to add it into SQL. Use

    engMpdIntersectList.Select(x => x.ToString()).ToArray()
    

    or if you have initially an ArrayList of ENG_MPD, use

    engMyTallyList.Cast<ENG_MPD>().Select(x => x.ToString()).ToArray()
    

    I initially thought of engMyTallyList to be a list of MyTally objects, not as they actually are ENG_MPD.

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

Sidebar

Related Questions

I try to convert my Cursor data to a arraylist<String[]>. But at the end
When I try to add a data-base in SQL Server 2008 (Right clicking on
When I try to add struct in two-dimensional array cin>>array[1][items.stoka_ime]; in error list write
I am trying some SQL code but I get an error when I try
Every once in a while I try to add a new data model version,
Getting data into and out of SQL tables with C# I built a C#
I am using Django's ManyToManyField, and when i try to add data to it,
I am trying to add data to a database, in grails but get this
Background: I am trying to add data to a SQL DB with C#. I
I try to get excel sheet names, with oledb. My connection string is: Provider=Microsoft.ACE.OLEDB.12.0;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.