Kevin,
I dug a little deeper into it. The SQL syntax is correct (even though I missed the " when I pased it into the message). And the following is true:
loDS.Tables[0].Rows.Count is equal to 1
loDS.Tables[0].Columns.Count is equal to 1
So I know there is a value in row 0 column 0 and I also know that it is not null.
Einar
>Hey, Einar,
>
>Maybe someone else can think of something else - but out of curiosity, what happens when you run the query in Query Analyzer? If there's some type of error with the exact syntax, or if the return is a NULL, that would explain the exception when you're trying to cast the return as an integer.
>
>So you might want to check the query in Query Analyzer, and also check the value of the single column object in the return dataset, before you try to cast it.
>
>Let me know if that helps...
>Kevin
Semper ubi sub ubi.