I think you're mixing up the variables - StrSql1 and SqlRS. Why would you check if StrSql1 is DBNull ?? It's your SQL statement !
On Jun 26, 11:12 am, gagandeep sharma <[email protected]> wrote: > i've a problems in comparing a values in asp.net, can anyonehelp me > > the code is below > > StrSql1 = "SELECT CAST(MAX(GRV_CODE) AS INTEGER)+1 AS CNT FROM > GRIEVANCE_DETAILS WHERE EST_CODE='" & DRP_DEPT.SelectedValue & "' " > > sqlcmd = New SqlCommand(StrSql1, dbcon) > > dbcon.Open() > > SqlRs = sqlcmd.ExecuteReader > > 'If isnull(StrSql1("cnt")) Then > > If IsDBNull(StrSql1) Then > > nextcode = CType(1, String) > > Else > > While SqlRs.Read() > > nextcode = Right("00" & CStr(SqlRs("cnt")), 2) > > End While > > End If > ------------------- > > suppose StrSql1 contains null value, then how can i compare it with a null > value in IF statement,pls help me > > -- > GO and LEAD from Whereever You are. > Think Big and Think Fast.
