Date parsed: 07/10/2007 20:12:38
Date: Mon, 8 Oct 2007 00:12:38 -0400
dim x as string = Convert.ToString ( a.UpdateAdStatus () )
lblMessage.Text = x
........
You do explicit converts/casts in order to avoid confusion.
Old VB6 code
dim s as string
s = 6 + 2
do you want 8 or "62"
...
In DotNet, you say what you want
dim s as string
s = Convert.ToString(6) + Convert.ToString(2)
's would be 62
s = Convert.ToString ( 6+2 )
's would be 8
.............
"bic" <bic@discussions.microsoft.com> wrote in message
news:08AC8570-2E91-49A2-8D81-70B03F64D52A@microsoft.com...
> when I do this in my page
> lblMessage.Text = a.UpdateAdStatus( ....);
> it causes an cannot implicitly convert type 'int' to 'string' error, for
> the method has a return type of int. Are you suggesting that I simply
> just do
> a.UpdateAdStatus( ....);
> instead?
>
> Thanks,
> --
> bic
>
>
> "sloan" wrote:
>
>>
>> I'd read this:
>>
>>
http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx>>
>> since you have a "throw", the exception gets bubbled up.
>>
>> the "page" you have would probably catch the exception, and then display
>> a
>> message to the user.
>>
>> in winforms, if you don't handle the exception in the "page", your app
>> will
>> crash.
>>
>> in webforms, if you don't handle the exception in the "page", your page
>> will
>> show a nasty dotnet type exception message.
>>
>>
>> "bic" <bic@discussions.microsoft.com> wrote in message
>> news:890C1EAD-F120-42F6-94E9-7443D53A6C4B@microsoft.com...
>> > Hi,
>> >
>> > Calling my method below how does my page caller display the exception
>> > since
>> > the return type is int?
>> >
>> > int ret = 0;
>> > string spname = "sp_UpdateAd";
>> > try
>> > {
>> > //Retrieve the parameters from the cache
>> > SqlParameter[] storedParams =
>> > SqlHelperParameterCache.GetCachedParameterSet( connString, spname );
>> > if( storedParams == null )
>> > {
>> > //Cache the parameters
>> > SqlParameter[] paramsToStore = new SqlParameter[]
>> > {
>> >
>> > };
>> > SqlHelperParameterCache.CacheParameterSet( connString, spname,
>> > paramsToStore );
>> > storedParams = paramsToStore;
>> > }
>> > ret = SqlHelper.ExecuteNonQuery( _trans, CommandType.StoredProcedure,
>> > spname, storedParams );
>> > }
>> > catch( Exception ex ) { throw; }
>> > finally{} // Do NOT dispose connection
>> >
>> > return ret;
>> >
>> > Thanks,
>> >
>> > --
>> > bic
>>
>>
>>