读取txt文件错误

moxh_snow 2007-06-15 04:35:09
我在vb.net下使用readLine()读取文本文件中的内容,文件只有一行,为什么有时能读取一行,有时只能读到第一个字符
...全文
256 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
leq_82 2007-06-17
  • 打赏
  • 举报
回复
我估计是你代码的问题
moxh_snow 2007-06-15
  • 打赏
  • 举报
回复
你的意思在读文件前不要打开吗?
moxh_snow 2007-06-15
  • 打赏
  • 举报
回复
我没有看出有何不同
dlzhangln 2007-06-15
  • 打赏
  • 举报
回复
Dim connectstring As String
Dim sr As New System.IO.StreamReader( Server.MapPath("") + "\connect.txt")
If File.Exists(ServerPath) Then
connectstring =sr.ReadLine()
End If
moxh_snow 2007-06-15
  • 打赏
  • 举报
回复
Dim connectstring As String
Dim objstream As StreamReader
Dim ServerPath As String
ServerPath = Server.MapPath("") + "\connect.txt" '得到数据库连接串文本文件
If File.Exists(ServerPath) Then
objstream = File.OpenText(ServerPath)
connectstring = objstream.ReadLine()

End If
dlzhangln 2007-06-15
  • 打赏
  • 举报
回复
代码

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧