If I TRY this..


Hi,

I was working on my ASP.NET application in this I need to Fetch the Image link from Database and show the Image and if the Image is not there in Database than i need to display the NoImage…

Simple..

Now, I ask my friends how to achieve this and they suggest me this..

if isdbnull(objSqlcmd.ExecuteScalar) then
Image= “Noimage.gif”
else
Image=objSqlcmd.ExecuteScalar
End if

hmm.. IF image is there .. Show that one other wish show NoImage.gif good one..

But Not for me I found that it actually run the Query twice and for one thing running a query twice is not a good idea..

so,

I do this…

Try
Image=objSqlcmd.ExecuteScalar
Catch
Image=”NoImage.gif”
End Try

and this what I said.. IF I TRY this..

Sumit Gupta