none
GetRowType RRS feed

  • Question

  • What _exactly_ for is method GetRowType which typed datasets generated code overrides?

    Looking in the MS reference code, it seems to me its used only in NewRowArray which is then used in

    GetErrors(), GetChildRows(...), GetParentRows(...) and RecordManager.GrowRecordCapacity().
    RecordManager is used to hold the rows references. I dont see any need, it need typed array, since RecordManager dont use any typed info anyway. Other 3 methods are public, so maybe some sense there (but I never used any of them).

    Am I right or completely lost?
    Thanks in advance for your insight,


    Martin [MCP]
    Tuesday, February 2, 2010 4:24 PM

All replies

  • Just to note why I ask: I want to add non-typed DataRow into existing typed DataTable and RecordManager refuse that. So I'm looking for background why that.
    So far it seems to me there is no real need for the refusal.
    Martin [MCP]
    Tuesday, February 2, 2010 4:27 PM
  • Hello Martin,

     

    Welcome to ADO.NET DataSet forum!

     

    It’s an interesting question!  Could you please tell us what exception that you encountered on the RecordManager?  Please provide us with some more detailed information, like callstack and sample codes to repro this problem.  

     

    Besides, I tested some codes in my lab.  If I used ImportRow method to add a non-typed DataRow into a typed DataTable, there are no problems. 

     

    I am looking forward to your post! 

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, February 3, 2010 6:58 AM
    Moderator
  • Well - ImportRow effectivelly adds new row with same values to the table. That is usually enough to fulfill the needs. But I try to understand why the DataTable is trying to make its internal structures strongly typed (via GetRowType virtual).

    The exception is ArrayTypeMismatchException. This exception is only 'reward' for having internal RecordManager's array strongly typed or atleast I can't find out others...


    Believe sample is not needed (and it will be long, since typed DSs are long). Just try to .Add(non-typed datarow) on any typed datatable.
    Martin [MCP]
    Wednesday, February 3, 2010 5:42 PM
  • Hi Martin,

     

    Thanks for your following up.  Could you please tell me how do you create a non-typed datarow?  With DataTable.NewRow(), the datarow will have a reference to the DataTable even if it is in detached state.   Then if we add such a row into typed datatable, we will receive an ArgumentException, “This row already belongs to another table”.   

     

     

    Have a nice day!

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, February 4, 2010 9:25 AM
    Moderator
  • Hi Martin,

     

    I am writing to check the status of the issue on your side.   

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, February 8, 2010 2:24 AM
    Moderator