Excel.QueryTable ignores some data types?

C

Colin Peters

Hello,

I have the following code:

Excel.Range range = (Excel.Range)shTable.Cells.get_Item(1, 1);
Excel.QueryTable qrytab =
(Excel.QueryTable)shTable.QueryTables.Add(sqlConnectionString, range,sql);
qrytab.CommandText = sql;
qrytab.CommandType = Excel.XlCmdType.xlCmdSql;
qrytab.Refresh(false);

It connects to a SQLServer2000 DB without problems and shows the data
from a view. The thing is, the bit fields get converted into the local
versions of True and False, which is fine. The GUID columns are not
displayed, which is also OK by me.

My question is: how does excel know why and how to do this? My deeper
question is: do I have to be careful about using particular data types
in my DB view/query? I'd hate to think that an important column might go
missing because of some obscure assumption by excel. Can I walk the
underlying data in a QueryTable?

BTW, if I use a sqldatareader instead, then all columns are returned.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top