Wednesday, March 21, 2012

Passing a CSV file into APSX page and returning query from SQL server using CSV data?

Is this possible basically?

I have a CSV file that contains a list of barcodes, I would like to create a page that will upload this into a temp table of some kind and query a SQL using the CSV file to join the data to the table.

This would then output the result to a list on the page.


Any ideas? As yet I haven't managed to start anything on ASP.net yet!

Of course it's possible. Almost anything is possible. When you get to your coding you should ask the specific questions that you need answered.


Here is one way on how to do this

1. Read your file using FileStream.
2. Create a datatable and its columns.
3. Loop through your file (using FileStream) and populate your datatable.
4. Create a dataview and set to the datatable.
5. Use rowfilter to filter out data you don't want to show.
6. Bind the data to your DataGrid or DataList to display the data onto the page.


Many thanks for your reply, more the kinda reply that I was hoping for.

The method that you have said, trying to understand this:

Does part 3 put the data into the database?

Where do I execute a query/sp to get the correct additional data back? (As more relevant data will be coming back based on a join to the new fields in the table)?

Thanks

0 comments:

Post a Comment