![](/img/trans.png)
[英]Is it possible to query all lines of an multi-line item with different dates, if some of the lines fall before a date you want to pull items after?
[英]Visual Studio 2010 Crashes after pasting a large multi-line string (Approximately 1500 lines)
我正在Visual Studio 2010中创建一个VB应用程序,该应用程序安装了一些SQL存储过程。 这些存储过程是经过加密的,否则我将向我的客户端提供.sql文件以创建存储过程。
用于创建存储过程的安装脚本的长度为1500行,并且已按照VS 2010要求使用多行文字的方式进行了格式化:
"First Line" & _
"Second Line" & _
"etc..."
每当我将多行脚本粘贴到Visual Studio中时,应用程序就会崩溃。 任何人都有更好的方法将非常大的字符串文字分配给字符串变量。 我需要的是以下内容:
Imports System.Data.Sql Client
...
cmd cmd as SqlCommand
dim str as string
str = _
"Very" & _
"Long" & _
... 1500 lines ...
"String"
cmd.CommandText = str
或以其他方式将.sql脚本分配给SqlCommand。
谢谢。
可以将其粘贴到记事本中并保存在其中,也可以将其拆分为多个字符串,然后将它们串联在一起。
甚至更好的是,将命令放在资源文件中并在运行时加载资源!
我也遇到了这个问题,以下代码对我有用:
cmd cmd as SqlCommand
dim str as string
str = "Very"
str &= "Long"
... 1500 lines ...
str &= "String"
cmd.CommandText = str
希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.