Save/Retrieve Long Text from VB.NET

  • I have a VB.NET/ADO app that saves/retrieves long text data from a memory stream to a file.  I now want to save/retrieve using an NTEXT variable in the database instead.

    From researching BOL and this site, it seems i have two options: 1) use an ADO recordset or 2) use a stored procedure with WRITETEXT/UPDATETEXT and READTEXT.  Unfortunately for option #2, it sounds like I can pass a long text stream as a stored procedure input parameter but cannot return a long NTEXT value from a stored procedure - I would have to return it in 4000 byte chunks.

    Does anyone have a recommendation on which approach is better, or a better suggestion, and any examples?

    Thanks!

     

    Rob H

  • Hi Rob

    What version SQL Server are you using?  If you're on sql 2k you can do basic oerations without using chunks, just use stored procs with @var declared as ntext and table col as ntext

  • Yes, I'm using 2K but can I pass the complete ntext value back from a stored proc to a VB.NET program and if so, how?

    Thanks

  • Rob,

    Just try select it out the table in the sproc and return straight to your vb.net app (via a datareader works for sure, (you are using a reador / adapter ?) - I use text fields like that without issues.

  • So simple!  That worked (using adapter).

    Thanks for tip,

    Rob

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply