Loading ...

HowToImportExcelData

Who is online?  0 guests and 0 members
home  »  forums   »  general topics   »  suggestions / feedback    » HowToImportExcelData

HowToImportExcelData

Posts under the topic: HowToImportExcelData

Posted: 7/27/2010

Lurker 15  points  Lurker
  • Joined on: 7/24/2010
  • Posts: 3

Recently i hav joined this community. And thanks for ur article which gave me an idea of using "HowToImportExcelData". Now i hav implemented it in my project. its working fine but i couldn insert datas into db successfully. ll u plz help me. i hav pasted the code here with

 Dim xlsDA As New OleDbDataAdapter()
        Dim xlsDS As New Data.DataSet()
        If Path.GetExtension(uploadFile).ToLower = ".xls" Then
            FileExport.PostedFile.SaveAs(Server.MapPath("\logsw") + "\" + uploadFile)
            uploadFile = Server.MapPath("\logsw") + "\" + uploadFile
            Dim xlsCon As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + uploadFile + ";Extended Properties=Excel 8.0;Mode=12;")
            xlsCon.Open()
            Dim xlsCmd As New OleDbCommand("SELECT * FROM [Sheet1$]", xlsCon)
            xlsDA.SelectCommand = xlsCmd
            xlsDA.Fill(xlsDS)
            xlsCon.Close()
        End If

        Dim insCon As New OdbcConnection(Web.Configuration.WebConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim insDA As New OdbcDataAdapter()
        Dim insDS As New Data.DataSet
        insDS = xlsDS
        insDA.Update(insDS)


Posted: 7/29/2010

Professional 8338  points  Professional
  • Joined on: 4/15/2009
  • Posts: 424
  Answered

rathipriya said:

but i couldn insert datas into db successfully.

This may help: http://aspsnippets.com/Articles/Read-and-Import-Excel-Sheet-into-SQL-Server-Database-in-ASP.Net.aspx

Note:

The best place to ask questions like this is at: http://codeasp.net/forums/asp-net-topics/13/data-access

Also since you are new to this forum then I'd suggest you to give this post a read: http://codeasp.net/forums/general-topics/frequently-asked-questions/472/codeasp-net-forums-tips-and-guidelines

Thank you and Welcome to CodeASP.Net


Posted: 8/2/2010

Lurker 15  points  Lurker
  • Joined on: 7/24/2010
  • Posts: 3

Thank you, Mr. Vinz. I saw the links that u hav given me. But after a big search only i hav posted this question. Since i m using MYSQL as back end ur link didnt full fill my requirement. Since in MYSQL we dont hav any "Open datasoursce" statements, i hav tried using those statement in asp.code itself. My only doubt is, its getting executed fine without any errors but the value i m storing in dataset is not getting stored in db when i update it in db using dataadapter. Plz just take a look at my code and help me where i m making wrong. Meanwhile i ll also try to solve.


Page 1 of 1 (3 items)