I have instantiated an SqlDataReader, and when using reader.GetString(1) -OR- reader["Details"], it only retrieves the first 4000 characters of the string. How do I get the rest?
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
try
{
while (reader.Read())
{
string foo = reader["Name"];
string bar = reader.GetString(1); //reader["Details"];
// bar ONLY has the first 4000 bytes - not the entire field!
}
}
Is the Details column in your database typed as text or ntext? If so, you need to use a method similar to that for blob data:
It's worth noting that TEXT and NTEXT are being deprecated. nvarchar and varchar are likely the types you are looking for.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.