.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Import Excal file into MySql database

Posted By: Naim Khan     Posted Date: May 05, 2009    Points:2   Category :Windows Application
Hello sir,

thank you so much to send me reply and give better idea. well sir if i m import exacl into Mysql then its also good thing. so tell me how can i import exacal file into mysql database using .net2005. if you have any code or solution of it then please reply me fast .its to urgent sir.
Thanks in Advance
Naim khan

Responses
Author: Athira Sreejith             
Posted Date: May 06, 2009     Points: 5   

Hi,

Refer:

http://www.daniweb.com/forums/thread109119.html

Author: baji             
Posted Date: May 10, 2009     Points: 5   

Hai,

Please refer this once,
Here 'PrmPathExcelFile'--is Excel File path

Here i'm binding Data from Excel to DataGrid.
if u want u can post this dataset data directly to Data base with out binding to DataGrid.


Dim MyConnection As System.Data.OleDb.OleDbConnection

Dim dao_dbE As DAO.DBEngine
Dim dao_DB As DAO.Database
Dim strFirstSheetName As String

dao_dbE = New DAO.DBEngine

dao_DB = dao_dbE.OpenDatabase(PrmPathExcelFile, False, True, "Excel 8.0;")
strFirstSheetName = dao_DB.TableDefs(0).Name

Try

''''''' Fetch Data from Excel

Dim DtSet As System.Data.DataSet

Dim MyCommand As System.Data.OleDb.OleDbDataAdapter


MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; " & "data source='" & PrmPathExcelFile & " '; " & "Extended Properties=Excel 8.0;")

' Select the data from Sheet1 of the workbook.

MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [" & strFirstSheetName & "]", MyConnection)


MyCommand.TableMappings.Add("Table", "ExcelData")

DtSet = New System.Data.DataSet

MyCommand.Fill(DtSet)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
DataGrid1.DataSource = DtSet.Tables(0)
DataGrid1.DataBind()

MyConnection.Close()

Catch ex As Exception
MyConnection.Close()
End Try

Author: Deepika Haridas             
Posted Date: August 22, 2009     Points: 5   

Hi,

Better to use SqlYog for that as it provides you to directly import .csv file which will also reflect in Mysql.

OR

You can also use an inline command provided by Mysql to import a .csv or .txt file



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend