[RESOLVED]Help with Binding null reference

I have this query, and I want to perform an If/Else condition on the result..

var menu= Convert.ToInt32(db.QueryValue("select * from UserProfile where UserID=@0 ",WebSecurity.GetUserId(WebSecurity.CurrentUserName)) ??0);

if (menu<1){

//condition1}else{
//other condition}

But I get Cannot perform runtime binding on a null reference Error message.

if (menu.Count() > 0)

{

your code here

or

if ( menu!= null)

{

Hello,

First of all, delete the ??0 at the end of the sql code.

then I do not understand what you want to do. Because menu always will be 1. Why do you want to check its value? You have only one user with that UserID?

hardweezy

But I get Cannot perform runtime binding on a null reference Error message.

Which line of code causes the error?

Leave a Reply