Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

DataSet does not support System.Nullable

$
0
0

Hello every one, I have a following piece of code
 
dt = new DataTable();
var result = from row in ObjContext.Users
select row;
dt = result.CopyToDataTable();
 
when I execute this I am getting this error "DataSet does not support System.Nullable<>."
 
In my table there are some blank Columns, and I must want to get its result in DataTable.
 

I also used following code from googling:
 
var result = from r in ObjContext.Users
select new
{
ID=r.ID,
Username= r.Username==null?"":r.Username,
Password= r.Password==null?"":r.Password,
SecLevel = r.SecLevel == null ? 3 : r.SecLevel,

Firstname = r.Firstname == null ? "" : r.Firstname,
Lastname = r.Lastname == null ? "" : r.Lastname,
BCC = r.BCC == null ? "" : r.BCC,
SenderEmail = r.SenderEmail == null ? "" : r.SenderEmail,

};
dt = result.CopyToDataTable();
 
but same porblem has comes.

Any help is much appreciated!!



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>