use*_*er1 3 c# sql-server ssis
所以我在SSIS ScriptCalled中有一列Data类型BlobColumn
我想将此列分配给一个string值。
我执行以下操作:
Row.Data = "MyString";
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
无法将类型'string'隐式转换为Microsoft.SqlServer.Dts.Pipeline.BlobColumn
那么我如何BlobColumn为一个String值赋值呢?
使用提供的答案将字符串转换为字节数组而不使用编码(逐字节)
我做了以下工作:
Row.Data.AddBlobData(GetBytes("MyString"));
Run Code Online (Sandbox Code Playgroud)
哪里:
byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5926 次 |
| 最近记录: |