Results 1 to 6 of 6

Thread: Cannot import Excel data

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Question Cannot import Excel data

    I am getting this error :

    Could not find installable ISAM.
    While trying to import my excel data into sql express database using following:

    Code:
    Dim excelConnection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=d:/test/Places.xls;Extended Properties=Excel 8.0;")
            excelConnection.Open()
            Dim excelCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO Locations [OBDC; Driver={SQLServer};Server=(local);Database=D:\PROJECTMW\MACHINEWALE\MACHINEWALE\DATABASEMW.MDF;Trusted_Connection=yes].[Places]SELECT * FROM [Place$];", excelConnection)
    
            
            excelCommand.ExecuteNonQuery()
            excelConnection.Close()
    Any suggestions?

    Lux.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Cannot import Excel data

    Code:
    Provider=Microsoft.Jet.OLEDB.4.0;DataSource=d:/test/Places.xls
    I'm not sure that this is the problem, but shouldn't the path separator be "\" instead?
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: Cannot import Excel data

    Done that! Still getting same error

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Cannot import Excel data

    This looks very suspicious to me:
    Code:
    Dim excelCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO Locations [OBDC; Driver={SQLServer};Server=(local);Database=D:\PROJECTMW\MACHINEWALE\MACHINEWALE\DATABASEMW.MDF;Trusted_Connection=yes].[Places]SELECT * FROM [Place$];", excelConnection)
    I don't know if it's OK to insert new records that way since I've never done it like that (and never seen it's being done like that either). What I normally do is to pull the data from excel into a dataset/datatable, and then insert the records from the dataset/datatable to the database in a separate step.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: Cannot import Excel data

    ok.. can u give me an example?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Posts
    362

    Re: Cannot import Excel data

    After some modifications i used the following command to import:

    vb Code:
    1. SELECT  Slno, State, District, City, Village, pincode
    2. INTO       [D:\PROJECTMW\MACHINEWALE\MACHINEWALE\databasemw.mdf].locations
    3. FROM     OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:\Test\Places.xls;IMEX=1', 'SELECT * FROM [Place$]') AS derivedtbl_1

    But i got the following error:

    "The specified schema name "D:\PROJECTMW\MACHINEWALE\MACHINEWALE\databasemw.mdf" either does not exist or you do not have permission to use it."
    what to do now?
    Last edited by LuxCoder; Nov 25th, 2009 at 03:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width