473,322 Members | 1,287 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,322 software developers and data experts.

Writing out "Long Text" from SQL Server to a file

RON
have to read a long text field (it's a PDF stored in a column) from SQL
Server in a VB.NET (2003) app. Here's the code I have:

Sub GetPDF(byval Path as string)
'objConnection created elsewhere; not the problem
Dim da As SqlDataAdapter = New SqlDataAdapter(QUERYSTRING),
objConnection)
'query string will only return the Long Text column; and only one row
Dim ds As DataSet = New DataSet("JustAName")
Dim MyData(0) As Char '''original code was cloned from another procedure
which
'read a byte array. I didn't design the SQL Server DB; it's from a vendor.
'The column is Long Text; holds a PDF
da.Fill(ds, "PDF-TableName")
Dim myRow As DataRow
myRow = ds.Tables("PDF-TableName").Rows(0)
MyData = CType(myRow(0), Char())
Dim ArraySize As Integer = New Integer
ArraySize = MyData.GetLength(0)
'write operation
Dim fs As FileStream = New FileStream(path, FileMode.OpenOrCreate,
FileAccess.Write)
fs.Write(MyData, 0, ArraySize) '''<<<PROBLEM. NEEDS A BYTE array
fs.Close()
end sub
SUB doesn't work. BUT NOT SURE why.

ANY HELP IS GRATEFULLY APPRECIATED

RON
Nov 7 '06 #1
0 1107

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Joe Peterson | last post by:
I could not find another example of this via internet searches, so here it is... I am wondering if this is a python bug or otherwise. The first example of this happened in a larger program of...
1
by: Paul Thakur | last post by:
I am writing vbscript code in an .asp page. I need to display field values from a sql table consisting of several fields, one of them is of type "Long Text". This field contains XML data. I like to...
5
by: Piotr B. | last post by:
Hello, I use MingGW g++ 3.2.3 on Windows 2000/AMD Athlon XP. I tried to output a "long double" variable using stdio printf(). I've tried various %formats (%llf, %Lf etc.), but none of them...
6
by: Otto Wyss | last post by:
I've the following function declaration: wxTree GetLastChild (const wxTree& item, long& cookie) const; I'd like to make the cookie parameter optional, i.e. "long& cookie = ....", without...
22
by: bq | last post by:
Hello, Two questions related to floating point support: What C compilers for the wintel (MS Windows + x86) platform are C99 compliant as far as <math.h> and <tgmath.h> are concerned? What...
12
by: Zero | last post by:
Hi everybody, i want to write a small program, which shows me the biggest and smallest number in dependance of the data type. For int the command could be: ...
0
by: RON | last post by:
I have to read a long text field (it's a PDF) from SQL Server in a VB.NET (2003) app. Here's the code I have: Sub GetPDF(byval Path as string) 'objConnection created elsewhere; not the problem...
0
by: Curious | last post by:
Hi, I have two columns defined as DateTime type in the Visual Designer, i.e., Dataset.xsd. In the grid to which the columns are bound, they're both displayed as date, for instance, 5/23/2007....
7
by: Spam Catcher | last post by:
Is it possible to change the autocomplete behaviour to search for the word instead of just checking for the prefix? For example, if I have the following items: Big Mac Quarter Pounder...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.