i am getting this error don`t know why...
here is Code (values in comments)..
protected void FormView1_ItemCommand(object sender, System.Web.UI.WebControls.FormViewCommandEventArgs e)
{
if (e.CommandName == "Update")
{
dsServicesTableAdapters.Select_NegotiateTableAdapter obj = new dsServicesTableAdapters.Select_NegotiateTableAdapter();
//here i am getting the input string is not in a correct format error
obj.Insert_Negotiate_New(Int32.Parse(stockid), //1
Decimal.Parse(txtfobcustomer.Text), //10
Decimal.Parse(txtfrieghtcustomer.Text), //10
Decimal.Parse(txtvanningcustomer.Text), //10
Decimal.Parse(txtinspectioncustomer.Text), //10
Decimal.Parse(txttotal_costcustomer.Text), //10
Int32.Parse(ddlCurrency.SelectedValue), // 0.0105
Int32.Parse(ddlcountry.SelectedValue), //5
Int32.Parse(customerid),//1
txtcustomername.Text, // Anglo
txtcustomerEmail.Text, // [email protected]
txtcustomer_phone.Text, // 03313752499
txtComments.Text, //test
Int32.Parse(ddlshipmenttye.SelectedValue)); //2
}
}
and here is my stored procedure
ALTER PROCEDURE [dbo].[Insert_Negotiate_New]
(
@stock_ID int,
@client_FOB_Price money,
@Client_FrieghtPrice money,
@Client_Vanning_Price money,
@Client_Inspection_Price money,
@Client_Total_Cost money,
@Currency_ID int,
@Country_ID int,
@Customer_ID int,
@Client_Name varchar(50),
@Client_Email varchar(50),
@Client_Phone varchar(50),
@Client_Comments varchar(3000),
@ShipmentType int
)
AS
SET NOCOUNT OFF;
declare @negotiation_ID int
set dateformat dmy
Begin---insert negotiation
SELECT @negotiation_ID=ISNULL(MAX(negtiation_ID),0)+1 FROM negotiate
INSERT INTO negotiate (negtiation_ID,Time_Stamp, stock_ID,client_FOB_Price, Client_FrieghtPrice, Client_Vanning_Price,
Client_Inspection_Price, Client_Total_Cost, Currency_ID,Country_ID,
Customer_ID, Client_Name, Client_Email, Client_Phone, Client_Comments, ShipmentType)
VALUES (@negotiation_ID,GETDATE(),@stock_ID, @client_FOB_Price, @Client_FrieghtPrice, @Client_Vanning_Price,
@Client_Inspection_Price, @Client_Total_Cost, @Currency_ID, @Country_ID,@Customer_ID,
@Client_Name, @Client_Email, @Client_Phone, @Client_Comments, @ShipmentType);
End
Table

Any Idea why i am getting this error although i am guessing that there are correct values
ddlshipmenttye.SelectedValueis 2? Could it be"2 "? (ie. with a space) And that goes for all the other parse calls as well. How sure are you that all of those will work?Int32.Parse(ddlCurrency.SelectedValue), // 0.0105Is0.0105the value in that field? Then why are you trying to parse it as an int? You should create validation to handle this sort of thing if that is the case, but my guess is that you wanted to usedecimal.Parseinstead.