我有一个问题,我无法解决.我正在使用SQL Server 2005,C#CLR来使用外部dll.问题在于参数的长度.我需要使用函数参数类型varchar(max)
.如果在C#代码,我使用string
,SqlSring
我不能使用T-SQL类型varchar(max)
,刚刚varchar(4000)
的nvarchar(4000)
.我需要说的是,当我需要使用超过4000个符号时,可能会出现这种情况,所以我需要知道,我需要使用哪种C#类型varchar(max)
.
我已经阅读了很多文章,其中有几篇说,为此,我可以使用SqlChars
.但!我有字符串操作.我如何使用string
或SqlString
然后转换为SqlChars
?(有可能SqlChars.ToString()
或SqlChars.ToSqlString()
).
我没有找到任何C#代码.
我用 Excel 应用程序 ( Microsoft.Office.Interop.Excel
)打开了 *.htm 文件。解析得真好!所以我可以使用它。为了提高速度,我试图从 Excel 范围获取数据并插入 System.Array 并使用它:
Excel.Range range = ExcelWorksheet.get_Range("A1", "H1500"); // get all values
System.Array dataArray = (System.Array)(range.Cells.Value2); // insert into array
Run Code Online (Sandbox Code Playgroud)
问题在于数据类型。如果 Excel 单元格具有时间或日期格式,则range.Cells.Value2
使:
12.06.2012 至 41072(Excel 单元格类型 - 日期)
14:48 至 0,6166666666666667(Excel 单元格类型 - 时间)
如果我从 Excel 单元格中获得单值,我得到正确的值(与Cells.Text.ToString()
):
ExcelWorksheet.get_Range("A1", "A1").Cells.Text.ToString()
Run Code Online (Sandbox Code Playgroud)
任务:我需要从 Excel Sheet 中获取值,就像文本一样,而不是另一种类型。
并且不希望 Excel 代替我思考 :)
我必须借助measure()
函数来测量多个值。
因为是异步操作,我只能写:
this.refContainerView.measure((x, y, width, height, pageX, pageY) => {
const containerViewHeight = height
this.refCommentList.measure((x, y, width, height, pageX, pageY) => {
const commentListOffset = pageY
const commentListHeight = height
// do something
})
})
Run Code Online (Sandbox Code Playgroud)
如果需要测量更多的组件,它看起来就像一个回调地狱。
是否可以同步编写代码,例如在await
或其他的帮助下,例如:
const contaierView = this.refContainerView.measure()
const commentList = this.refCommentList.measure()
// and then do something with
contaierView {x, y, width, height, pageX, pageY}
commentList {x, y, width, height, pageX, pageY}
Run Code Online (Sandbox Code Playgroud)