Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help by SQL Datatype TEXT

18 views
Skip to first unread message

Rolf Laumann

unread,
Jul 28, 2003, 4:51:07 AM7/28/03
to
Hallo all,
please give me help by reading SQL Datatype TEXT into string.

I try like this:
local _cString as string
_cString := fieldget(#text)

No Error, but also no data in _cString.

what happend?

regards rolf

Malcolm Gray

unread,
Jul 28, 2003, 5:31:10 AM7/28/03
to

You didn't post a sufficiently complete example?

I see a few options
1) You are not using the ADO RDD and hence the fieldget
function has no access to the "SQL" data
2) What you posted is not what you are doing.


Pierre Honore

unread,
Jul 28, 2003, 6:20:27 AM7/28/03
to
Rolf,

I think that you should also read the column being the primary key in your
query.

HTH,

Pierre

"Rolf Laumann" <rolf.l...@de.flextronics.com> wrote in message
news:bd2593cc.03072...@posting.google.com...

Rolf Laumann

unread,
Jul 28, 2003, 8:50:00 AM7/28/03
to
Hallo Malcolm,
here the answers:
1. I didn't use ADO RDD. I use ODBC Data Source "SQL Server Version:
2000.81.9001.00".

2. here is the complete sample ( I use SQL Server 7.0 or 2000 )

function readtext(cWrite) class My_app
local osql as sqlselect
local oconn as sqlconnect
local _cString := "" as string

oConn := SQLConnection{}
oConn:ODBCCursors := SQL_CUR_USE_ODBC

// Check for your own server
oConn:connect("sqlserver","uid","pwd")

oSQL:= sqlselect{"select top 1 * from texttest",oConn}
// Tabel testtext:


_cString := oSQL:fieldget(#testtext)


?_cString
// here you can see, that the result von fieldget is NULL_STRING

oSQL:FreeStmt(SQL_DROP)
oConn:Disconnect()
RETURN

Also I can't write any data to SQL Field (TEXT) with the function
Fieldput.

Regards rolf

"Malcolm Gray" <malcol...@jobstream.co.uk> wrote in message news:<i0n2gb...@192.168.1.252>...

Rolf Laumann

unread,
Jul 28, 2003, 8:56:07 AM7/28/03
to
Hallo Pierre,
I read only one record from the table. (include my primery key).
take a lokk on the answer to Malcolm. I post the example there.
Thanks
rolf

"Pierre Honore" <pierre...@options.fr> wrote in message news:<bg2tbh$k875s$1...@ID-179727.news.uni-berlin.de>...

Malcolm Gray

unread,
Jul 28, 2003, 9:04:17 AM7/28/03
to
Rolf Laumann wrote:
> Hallo Malcolm,
> here the answers:
> 1. I didn't use ADO RDD. I use ODBC Data Source "SQL Server
> Version: 2000.81.9001.00".

> _cString := oSQL:fieldget(#testtext)
OK - important difference to the original posting -
this is now a method call, the previous was a function call.

> Also I can't write any data to SQL Field (TEXT) with the
> function
> Fieldput.

Do you really mean the function?

I am afraid I have never used the sqlselect select class,
we use VO2ADO. Are you sure the table has at least
one row?


Markus Feser

unread,
Jul 28, 2003, 10:30:48 AM7/28/03
to
Rolf,

do you have a table texttest with a field texttest???
all you do is correct:

oConn := SQLConnection{ "odbcname", "user", "passwd" }

oSQL:= SQLSelect{"select top 2 * from TableName", oConn }
// better to use a where-Statement ;-)

// Check error, display ErrorMessage
// please check this ErrorMessage..., maybe the user didn't have rights???

oSQL:GoTop()

IF oSQL:ErrInfo:ErrorFlag
MessageBox( 0, oSQL:ErrInfo:ErrorMessage, "Error", MB_OK+MB_ICONERROR )
ELSE
_cString := oSQL:FieldGet(#FieldName)
ENDIF


oSQL:Close()
oConn:DisConnect()


Markus Feser


Markus Feser

unread,
Jul 28, 2003, 10:51:03 AM7/28/03
to
<g>

SELECT top 1 SubString(testtext,1,50) FROM texttest

this statement did work?...

Markus Feser


Michael Haensch

unread,
Jul 28, 2003, 1:51:42 PM7/28/03
to
Hallo Rolf,

some more possible errors to check:

1) in Interactive SQL (as it is called by Sybase) test your statement
"select top 1 * from texttest" for results
(I've never used in Sybase "top 1")

2) change your code to
oSQL:= sqlselect{"select testtext from texttest",oConn} // is this
working in ISQL ?
_cString := oSQL:fieldget(1)


Michael

"Rolf Laumann" <rolf.l...@de.flextronics.com> schrieb im Newsbeitrag
news:bd2593cc.0307...@posting.google.com...

Geoff Schaller

unread,
Jul 28, 2003, 5:53:40 PM7/28/03
to
Prove first that you actually retrieve a record to do the fieldget on.


"Rolf Laumann" <rolf.l...@de.flextronics.com> wrote in message
news:bd2593cc.03072...@posting.google.com...

Rolf Laumann

unread,
Jul 29, 2003, 2:27:43 AM7/29/03
to
Hi Michael,

to 1.) I'm using Microsoft SQL Server 2000 and in other App's I try
this select ("select top 1 * from ....) it works. I receive only the
first Row from the Select.

to 2.) I try this, but it does not work. I get 1 Row back from SQL
Server, but in the aSQLData Buffer from Debuger the field testtext is
null_string.

???? Why.
Regards Rolf


"Michael Haensch" <michael...@fritsche-entsorgung.de> wrote in message news:<bg3nrf$kjr$01$1...@news.t-online.com>...

Rolf Laumann

unread,
Jul 29, 2003, 2:33:24 AM7/29/03
to
Hi Malcolm,
I'm using the original SQLselect Fieldget Method from CA. (look
Helpfile SQLSelect).
The tabel has more then one row. I try to read the other rows also.
But it didn't work.
I have a very bih App in ouer factori, and it take a lot of time to
change complet to VO2ADO, but if there is no way to fix the problem, I
think, that I must change over to VO2ADO.
Regards,
Rolf

"Malcolm Gray" <malcol...@jobstream.co.uk> wrote in message news:<2g33gb...@192.168.1.252>...

Markus Feser

unread,
Jul 29, 2003, 4:09:22 AM7/29/03
to

Rolf,

NO JOKE!!!
I claim, this will work.

because this data type (text in SQLServer) is not supported by VO.

Markus Feser

Rolf Laumann

unread,
Jul 29, 2003, 4:58:34 AM7/29/03
to
Hi Markus,
Yes, I have a SQL tabel texttest (only for testing) and a field testtext.
The oSQL:ErrInfo:ErrorFlag return no error.
If I using the where -Statement, and select all Fields (select * ..where ...)
then I got the Value back.
Sample that works:
oSQL:= SQLSelect{"select uid, testtext from testtext where uid = 1", oConn }
oSQL:= SQLSelect{"select uid, testtext from testtext ", oConn }
oSQL:= SQLSelect{"select * from testtext where uid = 1", oConn }
oSQL:= SQLSelect{"select * from testtext ", oConn }


Sample that works not:
oSQL:= SQLSelect{"select testtext from testtext where uid = 1", oConn }
oSQL:= SQLSelect{"exec P_testtext 1",oConn}

Why doesn't work the stored Procedure from MS SQL Server??

Rolf

"Markus Feser" <markus.fese...@imsgear.com> wrote in message news:<bg3c2i$kfqua$1...@ID-72150.news.uni-berlin.de>...

Rolf Laumann

unread,
Jul 29, 2003, 5:03:31 AM7/29/03
to
Hi Geoff,
I get a record back.
Rolf

"Geoff Schaller" <ge...@softwareXXXXobjectives.com.au> wrote in message news:<EXgVa.19930$OM3....@news-server.bigpond.net.au>...

Pierre Honore

unread,
Jul 29, 2003, 5:13:21 AM7/29/03
to
Hi Markus and Rolf

> because this data type (text in SQLServer) is not supported by VO.

It is, but under some circumstances (maybe ODBC related) the data from a
data type "text" column will not be retrieved, a null string is returned
instead. Why ? I do not know.
What I have observed is that when too many (!?) columns are asked in the
query, or when only one column containing a text is queried, then the text
column will be a null string.
I have observed that when queried along with the primary key, a text column
will be what is stored in the base.

The workaround which works in all cases is to cast the text data type
columns into varchar( n )

HTH,

Pierre


Geoff Schaller

unread,
Jul 29, 2003, 8:41:35 AM7/29/03
to
Ok... then use VO2ADO. Its far superior anyway.


"Rolf Laumann" <rolf.l...@de.flextronics.com> wrote in message
news:bd2593cc.03072...@posting.google.com...

Markus Feser

unread,
Jul 29, 2003, 9:10:39 AM7/29/03
to
> Why doesn't work the stored Procedure from MS SQL Server??

Hello Rolf,

that should be work:

oStmt := SQLStatement{ "EXECUTE StoredProcName @var1 = ...", oConn }
oStmt:Execute()

Markus Feser

Rolf Laumann

unread,
Jul 31, 2003, 2:07:22 AM7/31/03
to
Hi Pierre and Markus,


"Pierre Honore" <pierre...@options.fr> wrote in message news:<bg5dpm$kri4e$1...@ID-179727.news.uni-berlin.de>...


> Hi Markus and Rolf
>
> > because this data type (text in SQLServer) is not supported by VO.
>
> It is, but under some circumstances (maybe ODBC related) the data from a
> data type "text" column will not be retrieved, a null string is returned
> instead. Why ? I do not know.
> What I have observed is that when too many (!?) columns are asked in the
> query, or when only one column containing a text is queried, then the text
> column will be a null string.
> I have observed that when queried along with the primary key, a text column
> will be what is stored in the base.

This is exactly that, that I found out through testing.


>
> The workaround which works in all cases is to cast the text data type
> columns into varchar( n )

But when I cast the text data type into varchar the limit of retrieved
chars is 8000 (nVarchar is 4000). In the Text field my be
2.147.483.647 chars.
I must work with long text. Thus 8000 (4000) bytes are not enough.


>
> HTH,
>
> Pierre

But thank you for the information.
Regards
Rolf

Markus Feser

unread,
Jul 31, 2003, 2:28:41 AM7/31/03
to
> > > because this data type (text in SQLServer) is not supported by VO.
> >
> > It is, but under some circumstances (maybe ODBC related) the data from a
> > data type "text" column will not be retrieved, a null string is returned
> > instead. Why ? I do not know.
> > What I have observed is that when too many (!?) columns are asked in the
> > query, or when only one column containing a text is queried, then the
text
> > column will be a null string.
> > I have observed that when queried along with the primary key, a text
column
> > will be what is stored in the base.
>
> This is exactly that, that I found out through testing.
> >
> > The workaround which works in all cases is to cast the text data type
> > columns into varchar( n )
>
> But when I cast the text data type into varchar the limit of retrieved
> chars is 8000 (nVarchar is 4000). In the Text field my be
> 2.147.483.647 chars.
> I must work with long text. Thus 8000 (4000) bytes are not enough.

Hi,

I hope this and the dirty __RecCount() Method will be fixed in 2.7
(perhaps Robert reads the message <g>)

Markus Feser


Michael Haensch

unread,
Jul 31, 2003, 2:14:24 PM7/31/03
to
Hi Rolf,

in Sybase I'm using for "memo fields" the long varchar data type.

If this data type "long varchar" exists in SqlServer, you can try to make a
"cast( testtest as long varchar)"

Michael

"Rolf Laumann" <rolf.l...@de.flextronics.com> schrieb im Newsbeitrag

news:bd2593cc.03073...@posting.google.com...

0 new messages