Uniqueidentifier type problem in a dataset...

  • Thread starter Thread starter Jérôme Poudou
  • Start date Start date
J

Jérôme Poudou

Hi,

I've a table with a uniqueindentifier column in SQL server
I want to fill an untyped dataset with a simple select * from table query,
but the uniqueindentifier column is empty !

if I cast my column in a varchar type, there is no problem.

Why ?
How to resolve the problem ?

thanks
Jerome.
 
Hi,

I've a table with a uniqueindentifier column in SQL server
I want to fill an untyped dataset with a simple select * from table
query, but the uniqueindentifier column is empty !

if I cast my column in a varchar type, there is no problem.

Why ?
How to resolve the problem ?

thanks
Jerome.

I have queries for data from tables containing a PK of uniqueIdentifier
(Guid)type, and it works just fine.

What do you mean that the value is empty? You get "DbNull.Value" when
you query the PK column value on the DataRow? or just plain "null"?

I'm not sure if it matters but I always specify the column names instead
of using '*'. I'm also using untyped datasets.

SqlCommand cmd = new SqlCommand("SELECT ProductID, Name, Description "
+ "FROM Product");

If you want to see code that works for your DB, then use the "database
app code generator" in my signature using the most recent template off
the same website. Let me know if that works for you.

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/colcodegen (simple code generator)
http://sourceforge.net/projects/dbobjecter (database app code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)
 
Well...

first, I'm using the microsoft data access application block.
this provide an SQLHELPER class.
I'm using the ExecuteDataset function to retrieve my data from SQL Server.
The code behind this function used the SQLCommand object and the Fill
function to fill the dataset.

After...
I say "empty" because the value in the GUID column is null, but it's my PK
and this column contain a value.

For the moment I've changed all my select statements and casted my GUID
columns.

Jerome.
 
Back
Top