各位好:
     请问哪位知道怎样才能把文本文件中的数据用代码的形式读入数据库。我是想在文本文件中读取每行数据先做判断再导入数据库!

解决方案 »

  1.   

    dim s as string
    open "x:\xxx\xxx.txt" for input as #1
    do while not eof(1)
      line input #1,s
      if ..... then
         '导入数据库
      end if
    loop
      

  2.   

    Dim one_line As String
     Open filename For Input As infile
       Do While Not EOF(infile)
            Line Input #infile, one_line'一行行取数据
            '在这里进行判断以及决定是否要写入数据库
           ..............
           ...............
       Loop
      

  3.   

    SPLIT函数,你的数据一般是按照TAB键分开,那么你使用A=SPLIT(S,VBTAB),就可以得到数据
    其中A是变体型数组.
      

  4.   

    Dim lngre As Long 
       lngre = readPrivateProfileString("工作表" + Str(num), "删除", tempstr, App.Path & "\CIMSSQL.ini")