asp把.txt导入access并生成相同的表名
时间:[2011-11-10 22:40:57] 作者:请作者尽快与我们联系。
以前用VB做的一个。。。 ASP写法应该差不多的! Dim IntSql(15) As String Dim result As Long, fileop As SHFILEOPSTRUCT With fileop .hWnd = Me.hWnd .wFunc = FO_COPY .pFrom = sourcepath & vbNullChar & vbNullChar .pTo = topath & vbNullChar & vbNullChar .fFlags = FOF_SIMPLEPROGRESS Or FOF_FILESONLY Or FOF_NOCONFIRMATION End With result = SHFileOperation(fileop) Dim conn As ADODB.Connection Set connsql = CreateObject("adodb.connection") strconn = "Driver={SQL Server};Description=sqldemo;SERVER=" + sqlip + ";UID=" + sqluid + ";PWD=" + sqlpwd + ";DATABASE=" + sqldatabase connsql.Open strconn SqL = "truncate table tablename" connsql.Execute (SqL) Open topath & path_bqjh For Input As #1 '为输入打开文件。 Do While Not EOF(1) '检查文件尾。 Line Input #1, InputData '读入一行数据。 SqL = "insert into tablename values ('" & IntSql(1) & "','" & IntSql(2) & "','" & IntSql(3) & "','" & IntSql(4) & "','" & Replace(IntSql(5), "'", " ") & "','" & Replace(IntSql(6), "'", " ") & "','" & IntSql(7) & "','" & Replace(IntSql(8), "'", " ") & "','" & IntSql(9) & "','" & IntSql(10) & "','" & IntSql(11) & "','" & IntSql(12) & "','" & IntSql(13) & "')" connsql.Execute (SqL) Loop Close #1 '关闭文件。 Label3.Caption = "数据库表" & Left(sql_bqjh, 5) & "更新完成" & Now Open topath & "log\" & Year(Now) & Month(Now) & Day(Now) & ".TXT" For Append Access Write As #2 Print #2, Label3.Caption Close #2
【声明】本站刊载的《asp把.txt导入access并生成相同的表名》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios