Open strFilePath & "\student.txt" For Input As #1 Do While Not EOF(1) Line Input #1, strLine If strLine <> "" Then strSql = " INSERT INTO 表名(Name,xuehao,jiguan,xingbie,shujjujieguo) Values ('" strsql=strsql & trim(mid(strLine,6,12)) & "','" _ & ........ & "')"
dbDATA.Execute strSql End If strLine = "" Loop Close #1
比如student.txt这个文件,转换成SQL Server数据库后,表中会有五个字段,把后面不要的3个字段删除即可。前两个字段中的数据如要去除“Name:”和“xuehao:”,直接写一条update的SQL语句就行了。
zyl910(910:分儿,我来了!)
为何才3星呀?
Do While Not EOF(1)
Line Input #1, strLine
If strLine <> "" Then
strSql = " INSERT INTO 表名(Name,xuehao,jiguan,xingbie,shujjujieguo) Values ('" strsql=strsql & trim(mid(strLine,6,12)) & "','" _
& ........ & "')"
dbDATA.Execute strSql
End If
strLine = ""
Loop
Close #1