473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 2534
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Roberto | last post by:
I have the following problem: I have the following form client side: <FORM.......> <FORM action="./WZUpload.asp" method="Post" enctype="multipart/form-data" WIDTH=100%> <INPUT Type="file"...
7
by: Niyazi | last post by:
Hi, I developed an application and I am using SQL Server 2000 developer edition. I create my database and I have also created tbl_USER table. I have an ID, RealName, UserName, and UserPassword...
2
by: Amanda | last post by:
From a guy in Microsoft newsgroups: | In *comp.databases.ibm-db2* there are always IBM guys | from the Toronto labs on line.Post with the | -for the love of god please help- | line...
2
by: jakk | last post by:
Below is the exception that Iam getting. It says that the DataView that Iam storing in the session is not Serializable. BUt works fine if I store in the inproc session and fails if I switch to...
4
by: jf li | last post by:
I have a Asp.net web application and a Asp.net Web service application. The Web application is using HtmlInputFile to get a 50M size of file selected by end user, read the data of this file and...
9
by: craig.overton | last post by:
All, I am currently developing an FTP class in VB.NET. It's kid tested, mother approved when trying to access an FTP Server on a Windows box meaning I can connect, run commands, upload and...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
2
by: Rob Pollard | last post by:
Hi All, I'm pretty new to using these technologies so bear with me. I have created a c# app which communicates with sql-server express 2005. When I run an insert on a table via the SqlCommand...
9
by: Gabriel | last post by:
Hello, I installed SQL server 2005 SP1 on a Windows XP SP2 From Visual Studio, I'm trygin to create a connection to a database, but I receive this error but I'm creating the connection (I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.