proc.Start()
proc.StandardInput.WriteLine("my ")
proc.StandardInput.WriteLine("t33")
'proc.StandardInput.WriteLine(command[0]); '"source D:\\Backup\\ib_response201812161030.sql");
proc.StandardInput.WriteLine("5.sql")
StreamReader sr = New StreamReader("upgrade.sql")
While(!sr.EndOfStream)
{
process.StandardInput.WriteLine(sr.ReadLine())
}
'End While
红代码报错:提示(!sr.EndOfStream)在While内,如何处理?
'sr.Close()
蓝代码报错:提示上下文不可访问,如何处理?
proc.Close()
[此贴子已经被作者于2024/3/9 9:32:37编辑过]
http://www.foxtable.com/webhelp/topics/0344.htm
Dim s As string = FileSys.ReadAllText("D:\Backup\upgrade.sql")
for each s1 as string in s.replace(vbcr,"").split(vblf)
process.StandardInput.WriteLine(s1)
next
proc.Start() proc.StandardInput.WriteLine("my ") proc.StandardInput.WriteLine("t33") 'proc.StandardInput.WriteLine(command[0]); '"source D:\\Backup\\ib_response201812161030.sql"); proc.StandardInput.WriteLine("5.sql")
|
Dim s As string = FileSys.ReadAllText("D:\Backup\upgrade.sql")
for each s1 as string in s.replace(vbcr,"").split(vblf)
process.StandardInput.WriteLine(s1)
next
还是报错一样的错
[此贴子已经被作者于2024/3/9 10:45:52编辑过]
StreamReader sr = New System.IO.StreamReader("D:\Backup\upgrade.sql")StreamReader sr = New StreamReader("D:\Backup\upgrade.sql")
报错StreamReader未声明?
参考上面使用FileSys.ReadAllText,没有必要搞那么复杂。如果一定要使用.net的代码,建议先花时间上网学一下基础的vb.net