Import data From MS Excel

forum.sourcecode (2000-2005) & forum.td.sourcecode (2005-2010)
Do Mai Huy

Import data From MS Excel

Post by Do Mai Huy » 02 Jul 2007, 06:47

 Posted by:  Do Mai Huy 

Help me Please

I need inport data from Ms Excel to my database. I using CT 1.51 and MS Sql
2000 Server.
Please send sample for me or Show me how to do.

Thank you

DMH

FRBhote
India
Posts: 2201
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Import data From MS Excel

Post by FRBhote » 02 Jul 2007, 08:17

 Posted by:  F R Bhote 

Save the excel as .CSV (or .TSV). Then :

While SalFileGetStr( hFile, sLine, 2000 )
Call SalStrTokenize( sLine, '', ',', sArray )

sArray[0], [1], .... are the excel columns.

Do Mai Huy

Re: Import data From MS Excel

Post by Do Mai Huy » 03 Jul 2007, 02:56

 Posted by:  Do Mai Huy 

Thank you F R Bhote

But can you show me more detail how to do or load sample file for me .

Thank so much

premcmenon
India
Posts: 38
Joined: 30 May 2018, 06:51
Location: India

Re: Import data From MS Excel

Post by premcmenon » 23 Jul 2007, 11:44

 Posted by:  Prem Menon 

Hi Do Mai Huy ,

This attached app file will read a xl - dbf file directly and insert the
content into a child table. you can update this code with a pushbutton which
will inserts the data into a database from the child window. you need xl -
activex libs to run this code. remember i am checking for a blank row for
breaking to loop , so the blank row show be the last row in ur xl file. let
me knw if u dn't hv apls.

-prem

You do not have the required permissions to view the files attached to this post.

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2370
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Import data From MS Excel

Post by Jeff Luther » 23 Jul 2007, 17:43

 Posted by:  Jeff Luther 

Prem - thanks for your sample! What is also helpful, however, is for you to
also include any APL libs. along with your APP file, zip all of them, and
submit that as your attachment.

You've got Excel 10.0 included in your app, but I only have a stub of that
version and cannot get your sample to compile. (And trying Excel 9.0 and 11.0
generate compile errors as well.)

Without the particular version of MS Office installed, others might not be
able to generate Excel 10.0 themselves. This has been the issue with so
many samples that include MS and other APLs: there's an APL version
dependency that is often difficult to duplicate. Thanks.

- Jeff

Mark Silver

Re: Import data From MS Excel

Post by Mark Silver » 09 Aug 2007, 11:42

 Posted by:  Mark Silver 

Hi, maybe you can try this directly

select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;DATABASE=C:\movs.xls', 'Select * from [page1$]')

Peter Tosh

Re: Import data From MS Excel

Post by Peter Tosh » 09 Oct 2007, 18:54

 Posted by:  Peter Tosh 

With query analyser Sql process the statement correctly, but I nee to use it
directly as
Call SqlPrepareAndExecute( hSql, "SELECT * FROM OPENROWSET(
'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;DATABASE=C:\\TMP\\movs.xls', 'SELECT *
FROM [INDEX$]' )" )
but TD 1.5.1 return OLE/DB error
Microsoft SQL Server:7312[Microsoft][ODBC SQL Server Driver][SQL
Server][OLE/DB provider returned message: Il modulo di gestione di database
Microsoft Jet non è riuscito a trovare l'oggetto 'I
Could not be right the sintax of statement?
Should hSql cursor be defined in particular mode?
Someone have a solution?
Tanks
PT

Return to “td.sourcecode”

Who is online

Users browsing this forum: [Ahrefs], [Ccbot] and 0 guests