How to import excel file data to mysql database
here is my uploading file coding
how to use my uploaded excel file to get it data and store it at database
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filepath As String = Server.MapPath("Files/")
Dim filename As String = FileUpload1.FileName
'Check if user has selected a file.
If FileUpload1.HasFile Then
If FileUpload1.PostedFile.ContentType = "application/vnd.ms-excel" Then
Try
'save the file at location path
FileUpload1.SaveAs(filepath & filename)
Catch ex As Exception
Label1.Text = "Error:" & ex.Message.ToString()
End Try
Else
Label1.Text = "You only can select .csv file "
Label2.Text = "Please select .csv file again"
End If
Else
Label1.Text = "You have not specified a file."
End If
End Sub
How to use the get data from excel file and store it to database thanks
helpful will appreciate

A simple way to do this would be to write a PHP script that imports the data.

Then have your form just hit that url and pass it's variables to it and process the file.

Simple enough right?

I only allow to use asp.net 2.0 by using vb.net language to write
I want is upload the excel file then get the data at excel file and store the data to database
thanks

Again I would still just use a LOADFILE call.

Either via ASP.NET or PHP or however else you want to do it.

LOADFILE is mysql based command and can be built into your query.

LOAD DATA LOCAL INFILE 'yourfile.txt' INTO TABLE `yourtable` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
This article has been dead for over six months. Start a new discussion instead.