如何用VB6将Excel的数据导入到SQL?
如何用VB6将Excel的数据导入到SQL?程序代码:
Public adoCon As New ADODB.Connection Public adoRs As New ADODB.Recordset Private Sub Command1_Click(Index As Integer) Select Case Index Case 1 Adodc1.RecordSource = "select * from ShortageData order by IA" Adodc1.Refresh If Adodc1.Recordset.RecordCount > 0 Then ' MsgBox Adodc1.Recordset.RecordCount Adodc1.Recordset.MoveLast adoCon.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ShortageReport;Data Source=mat326\sa" '怎样将Excel导入?从这我不会,可以指点吗? ' Set adoRs = adoCon.Execute("insert into ShortageData values(.......???怎么写?,,,,,)") adoCon.Close End If Case Else[local]1[/local] End Select End Sub Private Sub Form_Load() Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=ShortageReport;Data Source=huamat326\sa" End Sub
123.zip
(19.29 KB)