Quantcast
Channel: Strongly-typed reading values from CSV DataTable - Code Review Stack Exchange
Browsing index pages (7 articles)
↧

Strongly-typed reading values from CSV DataTable

Is there a way to do this using parameters so the value is automatically converted to whatever datatype the keyfield has in the datatable?This code should be reusable for future bulk update...

View Article


Answer by Saeed for Strongly-typed reading values from CSV DataTable

A few comments:This method does way too much. It is difficult to understand and will be difficult to debug and maintain. Break it down into smaller methods that each have a single responsibility.Use...

View Article


Answer by Mongus Pong for Strongly-typed reading values from CSV DataTable

Yup, that method does definitely need breaking down into smaller pieces.You may like to use an iterator method to loop through the lines. Something along the lines of :IEnumerable<string>...

View Article

Answer by Brian Reichle for Strongly-typed reading values from CSV DataTable

Just one small comment in addition to those provided by Saeed and Mongus, you have defined a constant called CSVKEYFIELDNAME but in the only place it is (shown to be) used, you call ToLower() on it....

View Article

Answer by Andris for Strongly-typed reading values from CSV DataTable

Is there a way to do this using parameters so the value is automatically converted to whatever datatype the keyfield has in the datatable?You could use something like this:object csvKeyValue =...

View Article


Answer by Sjoerd for Strongly-typed reading values from CSV DataTable

I noticed this code: parameters.DataTableOriginal.Select(DBKEYFIELDNAME +"='"+ csvKeyValue.ToString() +"'"). Just putting quotes around an user-input screams SQL Injection to me.The problem is that...

View Article

Answer by Nick Udell for Strongly-typed reading values from CSV DataTable

Prefer var in for loop variable initializers:for (int i = 1; i <= csvLines.Length - 1; i++)Should befor (var i = 1; i <= csvLines.Length - 1; i++)

View Article
Browsing index pages (7 articles)


Latest Images