when i try to insert from front end it is showing
Failed to convert parameter value from a String to a Int32. this error
when i try to pass the values with sp
--[usp_InsertMerchantBanks2] 'INDUSIND','INDB0001437',159491992426,'K JAYA SAI PRAKASH','HYDERABAD' values are inserting from front end not inserting how can i do it help me..
button click
protected void btnSubmit_Click(object sender, EventArgs e) { try { BankList bankList = new BankList(); bankList.BankName = txtBankName.Text; bankList.IFSC = TxtIFSCCode.Text; bankList.ActNumber = (long)Convert.ToDouble(TxtActNumber.Text); bankList.ACCHolderName = TxtAccHolderName.Text; bankList.BranchName = TxtBranchName.Text; bankBLL.InsertMerchantBanks(bankList); } catch(Exception ex) { throw ex; } }
my bll
public bool InsertMerchantBanks(BankList bankList) { try { return oBankDAL.InsertMerchantBanks(bankList); } catch(Exception ex) { throw ex; } finally { } }
mydal
public bool InsertMerchantBanks(BankList bankList) { bool oInsertBankDetails = new bool(); try { List<SqlParameter> objSQLParameterCollection = new List<SqlParameter>(); objSQLParameterCollection.Add(new SqlParameter { ParameterName = "@BankName", SqlDbType = SqlDbType.NVarChar, Value = bankList.BankName }); objSQLParameterCollection.Add(new SqlParameter { ParameterName = "@IFSC", SqlDbType = SqlDbType.Int, Value = bankList.IFSC }); objSQLParameterCollection.Add(new SqlParameter { ParameterName = "@ActNumber", SqlDbType = SqlDbType.BigInt, Value = bankList.ActNumber }); objSQLParameterCollection.Add(new SqlParameter { ParameterName = "@ACCHolderName", SqlDbType = SqlDbType.NVarChar, Value = bankList.ACCHolderName }); objSQLParameterCollection.Add(new SqlParameter { ParameterName = "@BranchName", SqlDbType = SqlDbType.NVarChar, Value = bankList.BranchName }); oInsertBankDetails = oSQLHelper.ExecuteNonQuery(DBProcedures._SP_InsertMerchantBanks, objSQLParameterCollection); } catch (Exception e) { throw e; } return oInsertBankDetails; }
my db
create table MerchantBanks2 ( BankName nvarchar(200) not null, IFSC nvarchar(80) null, ActNumber bigint null, ACCHolderName nvarchar(200) null, BranchName nvarchar(150) null CONSTRAINT PK_BN PRIMARY KEY(BankName) ) create procedure usp_InsertMerchantBanks2 ( @BankName nvarchar(200), @IFSC nvarchar(80) null, @ActNumber bigint null, @ACCHolderName nvarchar(200), @BranchName nvarchar(150) ) as begin insert into MerchantBanks2(BankName,IFSC,ActNumber,ACCHolderName,BranchName) values(@BankName,@IFSC,@ActNumber,@ACCHolderName,@BranchName) end