在Sql Server数据库中搜索二进制(byte [])数据? [英] Search binary (byte[]) data in Sql Server database?

查看:332
本文介绍了在Sql Server数据库中搜索二进制(byte [])数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将一些富文本格式保存到我的sql server数据库中,并且我的解决方案是将rtf字符串(从RichTextBox.Rtf实现)序列化为流,然后将该流转换为字节数组(byte []) ,最后,将这些字节保存到Sql服务器表的二进制(或映像)字段中.此解决方案可以很好地存储RTF,但我不知道如何在保存的数据中搜索某个关键字,您能告诉我该怎么做吗?
如果可能,您能否帮助我实现这两个目的:1.保存Richtext.
2.搜索保存的富文本.

I have to save some rich text into my sql server database, and my solution is serializing the string of rtf (achieved from RichTextBox.Rtf) into a stream, then converting this stream into an array of bytes (byte[]), and lastly, save these bytes into a field of binary (or image) of a Sql server table. This solution can store the richtext well but I don''t know how to search the saved data for some keyword, could you tell me how to do that?
If possible, could you help me achieve both of the two purposes: 1. Save richtext.
2. Search the saved richtext.
Your help would be highly appreciated!

推荐答案

很快就会想到,为什么不将rtf存储在二进制字段中,而将rtf的文本部分存储在单独的字段中呢?可以使用普通的SQL函数进行搜索.
Quickly comes in mind that why not store the rtf in binary field and the text portion of the rtf in a separate field that would be searchable using normal SQL functions.


这篇关于在Sql Server数据库中搜索二进制(byte [])数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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