Set conn = New Adodb.Connection
Set rs = New Adodb.Recordset
conn.ConnectionString = "Driver={sql server};server=qyl;uid=sa;pwd=;database=AERMS"
conn.ConnectionTimeout = 30
conn.Open
rs.Open "select * from gis", conn, adOpenStatic, adLockReadOnly, adCmdText
dim allLine as string
nNode = 0
Open TheInFileNode For Input As #1
Do While Not EOF(1)
Line Input #1, LineTemp
allLine=allLine & LineTemp & vbcrlf'-->加上这句,得到文件的所有内容
nNode = nNode + 1
Loop
Close (1)
请问这个TheInFileNode 我可以用rs代替吗 ??
Set rs = New Adodb.Recordset
conn.ConnectionString = "Driver={sql server};server=qyl;uid=sa;pwd=;database=AERMS"
conn.ConnectionTimeout = 30
conn.Open
rs.Open "select * from gis", conn, adOpenStatic, adLockReadOnly, adCmdText
dim allLine as string
nNode = 0
Open TheInFileNode For Input As #1
Do While Not EOF(1)
Line Input #1, LineTemp
allLine=allLine & LineTemp & vbcrlf'-->加上这句,得到文件的所有内容
nNode = nNode + 1
Loop
Close (1)
请问这个TheInFileNode 我可以用rs代替吗 ??
nNode = 0
Open rs.fields("FileName") For Input As #1
Do While Not EOF(1)
Line Input #1, LineTemp
allLine=allLine & LineTemp & vbcrlf'-->加上这句,得到文件的所有内容
nNode = nNode + 1
Loop
Close (1)
end if
TheInFileNode 为要读取的文本文件
而rs为gis对应表中的所有记录的记录集对象。
两者风牛马不相及,如何取代?!
nNode = 0
Open rs.fields(文件名字段) For Input As #1
Do While Not EOF(1)
Line Input #1, LineTemp
allLine=allLine & LineTemp & vbcrlf'-->加上这句,得到文件的所有内容
nNode = nNode + 1
Loop
Close (1)
rs.movenext '读取下一个文件的记录
loop
那个地方当然可以用rs代替:
Open rs.fields("某字段名") & "" For Input As #1
还是不大明白楼主的意思
记录集有多条记录,而那个地方只需要一个字符串哦
Set rs = New Adodb.Recordset
conn.ConnectionString = "Driver={sql server};server=qyl;uid=sa;pwd=;database=AERMS"
conn.ConnectionTimeout = 30
conn.Open
rs.Open "select * from gis", conn, adOpenStatic, adLockReadOnly, adCmdText
if not rs.eof then
nNode = 0
Open rs.fields("gis_point") For Input As #1
Do While Not EOF(1)
Line Input #1, LineTemp
nNode = nNode + 1
Loop
Close (1)
end ifReDim LonNode(1 To nNode), LatNode(1 To nNode), NoNode(1 To nNode)
Open rs.fields("gis_point") For Input As #1
For I = 1 To nNode
Input #1, LatNode(I), LonNode(I), LineTemp
NoNode(I) = Val(LineTemp)
Next I
Close (1)
这是完成对一个表的初始化 ,对吗??
你用rs.fields("gis_point")来代替,rs.fields("gis_point")得到的是文件路径和文件名么?
rs.Open "select * from gis_point", conn, adOpenStatic, adLockReadOnly, adCmdText
Open ????????? For Input As #1