Is excessive DataTable usage bad?

前端 未结 5 1960
面向向阳花
面向向阳花 2021-01-31 05:10

I was recently asked to assist another team in building an ASP .NET website. They already have a significant amount of code written -- I was specifically asked build a few indiv

5条回答
  •  隐瞒了意图╮
    2021-01-31 05:39

    yes I would be careful here...

    I had to look after a vb.net web app for about 2 months before I could re-write it all in C# .... I love C#, VB makes me want to hurl...

    Anyway, in the old app the previous developer had loaded data from the database into a datatable and then passed the datatable around a few methods which did absolutely nothing to the datatable, only for it to be assigned to a gridview. I was in utter disbelief.

    To make matters worse, there were times where he would actually dump the DataTable into a session... for no reason at all.

    DataTables etc are great, but only use them if you 'really' need to use them. The developer was soo bad that on search page he actually dumped all 5000 products from the database into a datatable and then performed a search on the datatable instead of performing the search in a stored procedure (ie. on SQL SERVER)

提交回复
热议问题