ADO.NET questions: DbType.Text -- set/get example...?

  • Thread starter Thread starter Frank Lopez
  • Start date Start date
F

Frank Lopez

Question: Can I use SqlDataReader.GetString() to read DbType.Text
field values that are larger than 8,000 characters? For example, if I
decide to store a 256K ASCII text string in a column, will
SqlDataReader.GetString() still be able to read it using a single
call?

Or, do I need to use SqlDataReader.GetChars() or some other methods?

Also, when setting a DbType.Text value that is greater than 8000
characters, do I need to use any special API calls, or can I just set
it as I would set a string field that is 50 characters?

Thanks,

Frank
 
See MSDN Library topic "NET Data Access Architecture Guide" for details of
using GetBytes to retrieve the data a bit at a time.

See also Knowledge Base Article PSS ID Number: 317034, which describes how
to use the ReadText and WriteText Sql statements to do the same thing.

The above article also implies that you can access the fields directly from
the DataReader's columns, although this can lead to much higher usage of
memory by the application.

Cheers,

Neil.
 
Yes, you could get and set the column in the same way regardless of column
length when you use the DataReader.

Visual Basic .NET
Jimmy

--------------------
 
Back
Top