将SQL脚本保存到资源中 [英] Save SQL Script into Resources

查看:85
本文介绍了将SQL脚本保存到资源中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有没有办法将SQL脚本存储到资源

文件中,脚本包含很多行,然后到

在运行期间将其读成字符串?


谢谢,

Hi,

Is there a way to store an SQL script into a resource
file, the script contains a lot of lines, and then to
read it during run-time into a string?

Thanks,

推荐答案

嗨Shai
Hi Shai
有没有办法将SQL脚本存储到资源
文件中,脚本包含很多行,然后再到
在运行期间将其读成字符串?
Is there a way to store an SQL script into a resource
file, the script contains a lot of lines, and then to
read it during run-time into a string?




为什么不呢,


或者你的意思是什么是最好的方法,我认为没有最好的方法,

取决于你想要使用它的环境。


如果你多说一点,我们可以帮助你吗?


Cor



Why not,

Or do you mean what is the best way, I think there is no best way, that
depends in what kind of environment you want to use it.

If you tell that a little more, than maybe we can help you?

Cor


" Shai Goldberg" < GS *** @ shamir.co.il> schrieb
"Shai Goldberg" <gs***@shamir.co.il> schrieb

有没有办法将SQL脚本存储到资源
文件中,该脚本包含很多行,然后在运行期间读取它-time into a string?

Is there a way to store an SQL script into a resource
file, the script contains a lot of lines, and then to
read it during run-time into a string?


http://msdn.microsoft.com/library/en...gResources.asp
http://msdn.microsoft.com/library/en...gresources.asp

-

Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


http://msdn.microsoft.com/library/en...gResources.asp
http://msdn.microsoft.com/library/en...gresources.asp
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


*" Shai戈德堡" < GS *** @ shamir.co.il> scripsit:
* "Shai Goldberg" <gs***@shamir.co.il> scripsit:
有没有办法将SQL脚本存储到资源
文件中,该脚本包含很多行,然后在运行时读取它一个字符串?
Is there a way to store an SQL script into a resource
file, the script contains a lot of lines, and then to
read it during run-time into a string?




将文件添加到项目中,将其Build Action设置为''Embedded

Resource'',然后:


\\\

进口System.IO

..

..

..

Dim f As Stream =

System.Reflection.Assembly.GetEntryAssembly()。GetM anifestResourceStream(_

"<根名称空间的名称> .test.txt" _



Dim st作为新的StreamReader(f),s As String

s = st.ReadToEnd()

MsgBox(s)

///


- -

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>



Add the file to the project, set its ''Build Action'' to ''Embedded
Resource'', then:

\\\
Imports System.IO
..
..
..
Dim f As Stream =
System.Reflection.Assembly.GetEntryAssembly().GetM anifestResourceStream( _
"<Name of the root namespace>.test.txt" _
)
Dim st As New StreamReader(f), s As String
s = st.ReadToEnd()
MsgBox(s)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


这篇关于将SQL脚本保存到资源中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆