i am trying to do something like this but it gives me error that cannot convert int to string , even the field which i am accessing from db is int and i parsed it into int but why ? here is my code:

userId = (int)com.Parameters["@ReturnValueUserId"].Value;
Response.Write(userId);
SqlDataSource1.InsertParameters["@userId"] = userId;

actually i am trying to insert userId into INSERTCOMMAND of sqldatasource control on .aspx page .

InsertCommand="INSERT INTO [tblJobAdv] ([advtitle], [startingdate], [endingdate], [mediumofadv], [refid], [jbid], [advDetails], [userId]) VALUES (@advtitle, @startingdate, @endingdate, @mediumofadv, @refid, @jbid, @advDetails, @userId)" 


<InsertParameters>
                <asp:Parameter Name="advtitle" Type="String" />
                <asp:Parameter DbType="Date" Name="startingdate" />
                <asp:Parameter DbType="Date" Name="endingdate" />
                <asp:Parameter Name="mediumofadv" Type="String" />
                <asp:Parameter Name="refid" Type="Int32" />          
                <asp:QueryStringParameter Name="jbid" QueryStringField="jbid" Type="Int32" />
                <asp:Parameter Name="advDetails" Type="String" />



</InsertParameters>

when i use .toString() with userid that been assigned , then it works , after changing Db field from int to Varchar but i want it to accept int variable, why it isn't accepting, send 8 hours but no progres, :( help
using sql server 2008 + asp.net3.5 (c#)

use Convert.ToInt32("your value which you want to convert from string to int.");

hope it will work

thanks

you are not adding userid.
Please add

<asp:Parameter Name="userid" Type="Int32" />