Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving TEXT data type from a VB app

Status
Not open for further replies.

CybOrg

Programmer
Nov 30, 1998
57
SE

I'm trying to retrieve a field of the type 'TEXT' from an SQL server database and can't figure out how to do it. I've written a syntactically correct stored procedure that I can execute and get the text in Query Analyzer, but it won't return any records in VB, and if I try to open a recordset with the code, I STILL don't get anything back...

Set Rsptr = DBConn.OpenRecordset("DECLARE @PtrVal varbinary(16) SELECT @PtrVal = textptr(Issue) From Issue WHERE ID = " & !Id & " readTEXT Issue.Issue @PtrVal 0 0 ", dbOpenSnapshot)

This part works - I get the pointer back...

If Not Rsptr.EOF Then Set RSIssues = DBConn.OpenRecordset("readTEXT Issue.Issue " & Rsptr!Pekare & " 0 0", dbOpenSnapshot)

No error here...
meddelande$ = meddelande$ & Trim(RSÄrende!Ärende) & vbCrLf
End If

Error - I don't get any column back...

/Cy
 
It looks like your coding with DAO. Try coding you data access with ADO (highly recommeded).


Keep'n it simple

reidfl



 
Thanks a lot, reidfl. Very helpful. :-( Now, if there's anybody out there who knows how to retrieve a TEXT field from SQL Server into a textbox, I'd be very grateful...
 
Do you want to check if the field is type text? Or are you just trying to read a text field from the database? I can answer both, but I don't use the ! to designate a field...

-------------------------------
If RSÄrende.Fields("Ärende").Type = 10 Then
'This is a Text field, may not be 10 for Sql Server, but
'you can play with it
End If

meddelande$ = meddelande$ & Trim(RSÄrende.Fields("Ärende").value & vbCrLf

Text1.Text = meddelande$

-------------------------------

As long as RSÄrende.RecordCount <> 0 this should work for you, assuming this is what you're looking for.

Good luck!

-Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top