Re: Problem reading column of type 'text' from Sql server
- From: "Aamir Mahmood" <a@xxx>
- Date: Tue, 4 Oct 2005 17:13:26 +0500
My text values are well larger than 8K in size (fall between 30-60K). May
be this is the problem. And my example with that large text still reads
empty strings.
I have VB6 (SP6) and MDAC 2.8, SQL Server 2000 (SP4), Win XP Pro (SP2)
Has someone ever got into this situation. I didn't know that using text
type would get me in this problem. But I can't use any other type.
A working example will be appreciated.
Thanks
-
AM
"Raj Kasi [MSFT]" <lkasi@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:OUaBOAIyFHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
>I will provide a simple example below. The text values are being read
>correctly without any issues.Replace the username, password, catalog, data
>source with appropriate values. As you can see below I am fetching the data
>into the recordset and reading the text column(s) values as you mentioned
>below. Also I am displaying them when the recordset is traversed.
>
> ==============================================================================
> Dim cn As New ADODB.Connection
> Dim txt As String
>
> cn.Open "Provider=SQLOLEDB;User ID=<username>;password=<password>;Initial
> Catalog=<catalog name>;Data Source=<data source name>"
>
> cn.Execute "create table temp_test(colint1 int, coltext2 text, colchar3
> char, coltext4 text, colint5 int)"
>
> cn.Execute "insert into temp_test values(1,'2. Testing text column
> 1234567890 abcdefghijkldhjdjhasdhfsdjhdf','a','4. Testing text column
> 1234567890 abcdefghijkljhajhdfsjhdf',5)"
>
> rs.Open "select * from temp_test", cn
>
> txt = rs.Fields("coltext2").Value
>
> MsgBox txt
>
> txt = rs.Fields("coltext4").Value
>
> MsgBox txt
>
> While Not rs.EOF
> For j = 0 To rs.Fields.Count - 1
> txt = rs.Fields.Item(j).Value
> MsgBox txt
> Next j
> rs.MoveNext
> Wend
>
> cn.Execute "drop table temp_test"
>
> cn.Close
> ==============================================================================
>
> -------------------------------------------------------------
> This posting is provided "AS IS", with no
> warranties, and confers no rights.Please
> do not send email directly to this alias.
> This alias is for newsgroup purposes only
> -------------------------------------------------------------
>
>
> "Aamir Mahmood" <a@xxx> wrote in message
> news:OYVHJCFyFHA.2848@xxxxxxxxxxxxxxxxxxxxxxx
>> Hi all,
>>
>> My code is like following
>>
>> dim rs as new adodb.Recordset
>> rs.open "select * from articles", myConn
>>
>> The problem is two of the columns in the table "Articles" are of type
>> 'text'
>> in sql server.
>> When I try to read them like
>> dim txt as string
>> txt = rs.Fields("ArticleText").Value
>>
>> It always reads a blank string?? Same is for the other column of 'text'
>> type.
>>
>> What I am doing wrong? Please help me.
>>
>> -
>> Amir Mahmood
>>
>>
>>
>>
>
>
.
- Follow-Ups:
- Re: Problem reading column of type 'text' from Sql server
- From: Raj Kasi [MSFT]
- Re: Problem reading column of type 'text' from Sql server
- References:
- Problem reading column of type 'text' from Sql server
- From: Aamir Mahmood
- Re: Problem reading column of type 'text' from Sql server
- From: Raj Kasi [MSFT]
- Problem reading column of type 'text' from Sql server
- Prev by Date: Q: Importing from Excel
- Next by Date: ADO table from a recordset
- Previous by thread: Re: Problem reading column of type 'text' from Sql server
- Next by thread: Re: Problem reading column of type 'text' from Sql server
- Index(es):
Relevant Pages
|
|