An error occurred while executing the command definition. See the inner exception for details.

Posted by Rajujrk under Regular Expressions on 2/23/2010 | Views : 18895 | Status : [Member] | Replies : 4
Hai,



I am using thebeerhouseVB code to leran about CMS technology, but i have received an error message while start execute the project.



The error is :

An error occurred while executing the command definition. See the inner exception for details.



It occur on the following code..

Dim lsmi As SiteMapInfo = (From lai In SiteMapctx.SiteMapInfos _
Where lai.URL = URL).FirstOrDefault
Return lsmi

Thanks & Regards

Rajkumar J



Responses

Posted by: Vuyiswamb on: 2/23/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
What does the inner Exception say


Thank you for posting at Dotnetfunda
[Administrator]

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajujrk on: 2/23/2010 [Member] Starter

Up
0
Down
that one i dont know and i cant able find why this error occurred?

Thanks & Regards

Rajkumar J

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/23/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
add the try block and display the inner exception it will tell us what is the problem;

Thank you for posting at Dotnetfunda
[Administrator]

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/23/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
The only possiblility of getting an exception from the code is if an object from SiteMapctx.SiteMapInfos contains Null.

Thus NullReferenceException will occur while running the LINQ statement lai.URL. If lai is Null, lai.URL will through NullReference

So it is better to check an object before calling the URL.,

www.abhisheksur.com

Rajujrk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response