I hope this is the right forum for my question.
I'm developing a website for a Prepaid Calling Cards distributor. Each of the cards they sale have a list of the countries the card is good for. I need to import this data into my countries_rates table. The file they are giving me is an excel file that contain 3 colums (fields)
1- Country-Name
2- Rate
3- Card_$_Price
these files contain aproximaly 400 rows so it will be a hasle to have to insert it manually every week.
In my web application I need to create a form where the user will select the card from a dropdownlist and then find the excel file to be imported for that card.
I would like to know how do I do that with Visual Studio 2005, SLQ 2005 and C#
please direct me to some links where I can learn how to do this or please send me some code snips I can see how is done.
Tia
Charles
In short - here's some old (.NET 1.1) code I used. Basic idea is to uploadfile and then open the excelfile by using a OleDbConnection.
Dim strConnAs String ="Provider=Microsoft.Jet.OleDb.4.0;" _ &"data source=" & sFileName &";" _ &"Extended Properties=Excel 8.0"Dim objConnAs New System.Data.OleDb.OleDbConnection(strConn)Dim oAdapterAs New System.Data.OleDb.OleDbDataAdapter("SELECT * from " &"[Sheet1$]", objConn)
Dim ExcelDataAs DataSet =New DataSetDim oCollAs New CollectionDim nErrAs IntegernErr = 0Dim sErrAs StringTry objConn.Open() oAdapter.Fill(ExcelData)
Now you have the data from Excel in the dataset ExcelData and can loop through it and
insert it/update your SQL db|||
Thanks for the code snip. But I don't use VB I'm using C# do you have the C# version. Sorry to be such a pain
Tia
Charles