带有字节数组VB.NET的Datatable.select [英] Datatable.select with byte array VB.NET

查看:207
本文介绍了带有字节数组VB.NET的Datatable.select的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从SQL存储过程中填充了一个数据表,并且需要对该数据表做进一步的过滤。数据表保存从SQL DB作为varbinary返回的数据,并作为字节数组存储在数据表中。我试图传递TheData!Hash,它也是一个字节数组。

I have populated a datatable from a SQL stored procedure and need to do further filtering on the datatable. The datatable holds data that is returned from the SQL DB as varbinary and is stored in the datatable as a byte array. I am attempting to pass TheData!Hash which is also a byte array.

当我需要过滤数据表时,我使用了以下内容:

When I need to filter the datatable I have use the following:

Dim sQuery0 As String = "Hash=" & TheData!Hash
Dim ResultRows As DataRow() = dt.Select(sQuery0)

I理解TheData!Hash是一个字节数组,无法以这种方式转换为字符串,但是到底如何在Select过滤器表达式中传递字节数组?

I understand that the TheData!Hash is a byte array and cannot be converted to a string in this way but how on earth do I pass the byte array in the Select filter expression?

推荐答案

我不相信您可以使用它。 TheData!Hash是什么类型?字节()?然后,如果您在代码中进行了此比较,则无论如何都将是参考比较。

I don't believe you'll get this to work. What's the type of TheData!Hash? Byte()? Then if you did this comparison in code, it would be a reference comparison in any case.

看看对数据集的LINQ 。您会发现它比.NET 1.0中的Select方法更加灵活。

Take a look at LINQ to DataSet. You'll find it much more flexible than the Select method, which is from .NET 1.0.

这篇关于带有字节数组VB.NET的Datatable.select的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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