Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > InvalidCastException in dataset designer generated code

Reply
Thread Tools

InvalidCastException in dataset designer generated code

 
 
John Dalberg
Guest
Posts: n/a
 
      03-24-2006
The code below (generated by the dataset designer) is receiving an
exception because the 'searchfor' column has nulls but this column in SQL
Server allows nulls. What am I missing? Shouldn't the generated code check
for DBNull first?





[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public string SearchFor {
get {
try {
return
((string)(this[this.tableXML.SearchForColumn])); }
catch (System.InvalidCastException e) {
throw new System.Data.StrongTypingException("The
value for column \'SearchFor\' in table
\'XMLElement\' is DBNull.", e); }
}
set {
this[this.tableXML.SearchForColumn] = value;
}
}

John Dalberg
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
#region Web Form Designer generated code JakeC ASP .Net 1 12-15-2003 01:40 PM
Designer generated code nakhi ASP .Net 1 08-22-2003 11:45 AM
Web Form Designer Generated Code - Get Me Outta Here!! :-) Leeor Geva ASP .Net 1 08-22-2003 12:01 AM
Web Form Designer Generated Code - Get Me Outta Here!! :-) Zoury ASP .Net 0 08-21-2003 08:42 PM
Problem in Designer generated code pepsi ASP .Net 0 06-26-2003 03:45 PM



Advertisments