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代替吗 ??

解决方案 »

  1.   

    if not rs.eof then
        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
      

  2.   

    ?????
    TheInFileNode 为要读取的文本文件
    而rs为gis对应表中的所有记录的记录集对象。
    两者风牛马不相及,如何取代?!
      

  3.   

    是不是gis表有个字段对应文本文件?!Do While Not rs.eof
        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
      

  4.   

    初始化?问题能具体一点吗?另外TheInFileNode文本文件和你表之间的关系是什么?
      

  5.   


    那个地方当然可以用rs代替:
    Open rs.fields("某字段名") & "" For Input As #1
        
    还是不大明白楼主的意思
    记录集有多条记录,而那个地方只需要一个字符串哦
      

  6.   

    哦,我是要在mapx上作最短路径.我先要读取数据库中的点和弧的属性.
      

  7.   

    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
    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)
    这是完成对一个表的初始化 ,对吗??
      

  8.   

    open 语句中,在open 与 for 之间只能是一个文件的路径和名称哦
    你用rs.fields("gis_point")来代替,rs.fields("gis_point")得到的是文件路径和文件名么?
      

  9.   

    你先把Open 。。 For Input As #1 的含义搞清楚再说吧
      

  10.   

    请问我如何用文件名来代替我从数据库中取出的纪录
     rs.Open "select * from gis_point", conn, adOpenStatic, adLockReadOnly, adCmdText
    Open ?????????  For Input As #1