Last post Nov 06, 2014 01:39 AM by Kevin Shen - MSFT
Oct 28, 2014 04:00 PM|march11|LINK
I have what is probably a common issue but just can't for the life of me think of a good way to do this.
The requirement is for the web site to read in an ftp file. No problem. The file is a CSV with first row header, that matches up with a table, where the CSV contains all or some sub set of the header values. The remaining CSV rows correspond to the header
rows within said CSV. So inserting these records to the table is not expected to be an issue.
The issue is that the header rows are cryptic, A45D34, A45D35, A45D36, etc. (hundreds of columns). There is a corresponding CSV file that lists all of the column headings along with the corresponding display text to be used whenever a query is written against
the table to display the data.
I am wondering if there is someway to take advantage of the SQLDATASOURCE and query both tables, one with the data and the other with the display text and bind it to, for example, a Gridview, or other display control within a web form .aspx page.
Any tutorials, examples, links, suggestions, or ideas would be greatly appreciated.
Oct 29, 2014 05:38 AM|Kevin Shen - MSFT|LINK
Based on my understanding ,you can merge the two data table like below:
More details ,please refer to the link below:
Then bind the datatable to your gridview.
Oct 29, 2014 08:07 AM|march11|LINK
Very interesting approach but I still need to store the data in a SQL db. I would need to figure out what is new about one of the tables in the merge process and then build a SQL query to either Alter or Create a new table to store the records.
I will investigate this option, thank you. I not sure it will directly help solve my requirement but it offers some flexibility in handling the sub set of data from the CSV.
Oct 29, 2014 10:15 PM|Kevin Shen - MSFT|LINK
If you want to save the new merge table ,you can simply create query to store it in database.
Oct 30, 2014 12:04 PM|march11|LINK
How would I go about typing each of the parameters if the table has not yet been defined?
Nov 06, 2014 01:39 AM|Kevin Shen - MSFT|LINK
If you haven't define the table ,you can get the table column names from your data table .
Then create sql query based on the column names .then use ado.net to create table and insert data for your table.