Home > database >  New people for help: excel import database
New people for help: excel import database

Time:10-06

1, how to detect the excel file has several worksheets, and will be one of the import SQL database?
2, the computer without install pb, essentially a case, in addition to kao into exe files and SQL DBF files also need kao into which files, in order to let the application run?
Beg each ace to give directions, thank you!

CodePudding user response:

Much work!

CodePudding user response:

On your second question:
Libjcc. DLL pbdir80. DLL pbdwe80. DLL pblab80. Ini pbodb80. DLL
Pbodb80. Ini pbsyc80. DLL pbsyj80. DLL pbtra80. DLL
Pbvm80. DLL

My is pb8.0, not necessarily to yo, you can consult

CodePudding user response:

The first question:
SetPointer (HourGlass!

String ls_path ls_filename, ls_saveasname
The integer li_gfo
Long excelok

Li_gfo=GetFileOpenName (" select file to import, "ls_path ls_filename," DOC ", "Excel Files (*. XLS), *. XLS")

If li_gfo=0 Then Return//cancel operations

If li_gfo=1 Then
Messagebox (' system ', 'failed to import file')
Return
End the If

OLEObject ExcelServer
ExcelServer=Create OLEObject
Excelok=ExcelServer. ConnectToNewObject (" excel. Application ")

If excelok & lt; 0 Then
MessageBox (" connection excel failed, check your system to install office ", String (excelok))
Return
The Else

Ls_saveasname="c: \ emp. TXT"//save the sheet content of temporary files

Li_sheetcount=ExcelServer. Sheets. Count

//cycle take each sheet
For li_loop=1 to li_sheetcount step + 1

ExcelServer. WorkSheets (li_loop). SaveAs (ls_saveasname, 3)//save as a text file
ExcelServer. Displayalerts=False
Dw_name. ImportFile (ls_saveasname)//data window to meet
Dw_new. AcceptText ()
FileDelete (ls_saveasname)
Next

//disconnected exit
FileDelete (ls_saveasname)
ExcelServer. ActiveWorkbook. Saved=true
ExcelServer. Quit ()
ExcelServer. DisconnectObject ()
Destroy ExcelServer
End the If

Setpointer (Arrow!

CodePudding user response:

Ls_saveasname="c: \ emp. TXT"//save the sheet content of temporary files
Followed by:
ExcelServer. Workbooks. OPEN (ls_path)
  • Related