M
motohm
Unregistered / Unconfirmed
GUEST, unregistred user!
将Excel表导入到SQL数据库,执行下面的代码出错,什么原因?sqlcmd :='INSERT INTO ' + tablename +' ('+FieldNames +') SELECT '+FieldNames + ' FROM OpenDataSource(''Microsoft.Jet.OLEDB.4.0'','+ '''Data Source="'+DataFileName+'";'+ 'Extended Properties="Excel 8.0;HDR=Yes;";Persist Security Info=False'')...['+cbImportTable.Text+']'; try ADOConnection1.Execute(sqlcmd); except on E:exception do Application.MessageBox(PChar(E.Message),‘出错’,MB_ICONSTOP); end;