The MSDN includes example for using SqlTypes with data reader.
How would I use it with DataSet?

The following code snip throws an InvalidCastException for the line:
SqlString s = (SqlString) o;

I don't want to cast o.ToString() as the variable might by null.

Thanks,
Saar

<snip>
DataSet ds = new DataSet();
new SqlDataAdapter ("select * from categories", cnn).Fill (ds);

foreach (DataRow row in ds.Tables[0].Rows)
{
object o = row["CategoryName"];
SqlString s = (SqlString) o;

Console.WriteLine (s.ToString());
}
</snip>


On Tue, 21 May 2002 11:09:01 -0400, Marsh, Drew <[EMAIL PROTECTED]> wrote:

>Saar Carmi [mailto:[EMAIL PROTECTED]] wrote:
>
>> Does anyone use the System.Data.SqlTypes namespace ?
>
>Absolutely.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to