469,622 Members | 1,462 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,622 developers. It's quick & easy.

vb.net and sql server express binary data type

Ty
I have a SQL server 2000 DB that Ihave copied onto my PC and am using
SQL server express 2005 to view.

I created a project in VB.net and am reading the data out of the DB
using System.Data.SqlClient

Here is the problem. I am redaing the table fields into variables. All
are fine except one.

The table has one field that is a binary data type. This field holds
anything from a block of text to MS Word docs, Excel spread sheets,
and images.

I made the variable int a Object type "Dim vararticle As Object"

The data seems to be placed into the variable.

In this instance I know that the data is just a block of text about a
paragraphs worth. I thought I could place it into a textbox like this
TextBox1.Text = vararticle but no luck.

So the question is how do I get it out of the variable and into the
textbox?

Thanks,
Ty
Jun 27 '08 #1
4 2355
Ty,

You are not ready by just setting the blob in an object.

You should have to know what kind of data it is and then stream the data
back into the proper type.

Here the code as it is an image. (Your part is method 4)

http://www.vb-tips.com/DataSetImage.aspx

Cor

"Ty" <tb*****@lewistownhospital.orgschreef in bericht
news:9e**********************************@f63g2000 hsf.googlegroups.com...
>I have a SQL server 2000 DB that Ihave copied onto my PC and am using
SQL server express 2005 to view.

I created a project in VB.net and am reading the data out of the DB
using System.Data.SqlClient

Here is the problem. I am redaing the table fields into variables. All
are fine except one.

The table has one field that is a binary data type. This field holds
anything from a block of text to MS Word docs, Excel spread sheets,
and images.

I made the variable int a Object type "Dim vararticle As Object"

The data seems to be placed into the variable.

In this instance I know that the data is just a block of text about a
paragraphs worth. I thought I could place it into a textbox like this
TextBox1.Text = vararticle but no luck.

So the question is how do I get it out of the variable and into the
textbox?

Thanks,
Ty
Jun 27 '08 #2
Ty
On May 11, 10:28*am, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
Ty,

You are not ready by just setting the blob in an object.

You should have to know what kind of data it is and then stream the data
back into the proper type.

Here the code as it is an image. (Your part is method 4)

http://www.vb-tips.com/DataSetImage.aspx

Cor

"Ty" <tbar...@lewistownhospital.orgschreef in berichtnews:9e**********************************@f 63g2000hsf.googlegroups.com...
I have a SQL server 2000 DB that Ihave copied onto my PC and am using
SQL server express 2005 to view.
I created a project in VB.net and am reading the data out of the DB
using System.Data.SqlClient
Here is the problem. I am redaing the table fields into variables. All
are fine except one.
The table has one field that is a binary data type. This field holds
anything from a block of text to MS Word docs, Excel spread sheets,
and images.
I made the variable int a Object type "Dim vararticle As Object"
The data seems to be placed into the variable.
In this instance I know that the data is just a block of text about a
paragraphs worth. I thought I could place it into a textbox like this
TextBox1.Text = vararticle but no luck.
So the question is how do I get it out of the variable and into the
textbox?
Thanks,
Ty- Hide quoted text -

- Show quoted text -
Thanks for the tip.

Once this goes into production I will not know what type of data is in
the field. The user can add just about anything.

This should get me started once I tweak it.

Thanks,
Ty
Jun 27 '08 #3
Ty
This is what I came up with that works great.

With rs.Read
Dim HoldByte() As Byte = CType(rs(0), Byte())
Dim strholder As String
For i = 0 To HoldByte.Length - 1
strholder = strholder & Chr(HoldByte(i))
Next

TextBox1.Text = strholder

End With

Thanks,
Ty

Jun 27 '08 #4
"Ty" <tb*****@lewistownhospital.orgschrieb
This is what I came up with that works great.

With rs.Read
Dim HoldByte() As Byte = CType(rs(0), Byte())
Dim strholder As String
For i = 0 To HoldByte.Length - 1
strholder = strholder & Chr(HoldByte(i))
Next

TextBox1.Text = strholder

End With
Ummm.... what do you expect to see in the Textbox? Aliens?
Armin
PS: StringBuilder class is great
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rob Pollard | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.