none
Visual Basic 6.0 Max Record Property to C sharp RRS feed

  • Question

  • What is equivalent C sharp logic using Visual Basic 6.0 Max number of records property. I am working with a disconnected datatable.


    Transferring logic to C sharp.


    Visual Basic:

    recordset.MaxRecords

    C sharp:

    using datatable

    ????????
    Monday, October 27, 2014 6:54 PM

Answers

  • Hello pianoboyCoder,

    I'm not aware of this kind of method or property. You can check datatable yourself:

    http://msdn.microsoft.com/en-us/library/system.data.datatable(v=vs.110).aspx

    All peoperties haven't metioned what you need.

    We can only get data.rows.count to caculate the number. Why you need to set a MaxRecords? It has already been listed in the following:

    To add rows to a DataTable, you must first use the NewRow method to return a new DataRow object. The NewRow method returns a row with the schema of the DataTable, as it is defined by the table's DataColumnCollection. The maximum number of rows that a DataTable can store is 16,777,216. For more information, see Adding Data to a DataTable.

    Regards,



    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, October 28, 2014 9:56 AM
    Moderator

All replies

  • Hello pianoboyCoder,

    I'm not aware of this kind of method or property. You can check datatable yourself:

    http://msdn.microsoft.com/en-us/library/system.data.datatable(v=vs.110).aspx

    All peoperties haven't metioned what you need.

    We can only get data.rows.count to caculate the number. Why you need to set a MaxRecords? It has already been listed in the following:

    To add rows to a DataTable, you must first use the NewRow method to return a new DataRow object. The NewRow method returns a row with the schema of the DataTable, as it is defined by the table's DataColumnCollection. The maximum number of rows that a DataTable can store is 16,777,216. For more information, see Adding Data to a DataTable.

    Regards,



    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, October 28, 2014 9:56 AM
    Moderator
  • Disconnected datatables are pretty old school.

    Most devs now use entity framework.

    I think if you're new to .net you're best advised to take a look into EF.

    It does all the translation to and from database-objects for you and you can work in LINQ - which is great.

    You'd have a collection per entity/table and you can use count to see how many you have.

    http://msdn.microsoft.com/en-gb/data/jj574232.aspx

    Tuesday, October 28, 2014 11:06 AM
    Moderator
  • you can use

    DataTable.Rows.Count 

    to Find the Max Records Like VB6

    Code

                DataTable dt = new DataTable();
                //Code for Loading Data into DataTable
                int MaxRecords = dt.Rows.Count;
    


    Happy Coding, RDRaja


    Tuesday, October 28, 2014 11:35 AM