Click here to Skip to main content
15,886,199 members

getting error on inserting values

ruby kaur asked:

Open original thread
Hi,
Getting error on insert page. i am enclosing my code of both pages aspx.cs and bussiness logic page and error. please help me out. Thanx in advance

Aspx.cs page on insert

protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (objSaleSanctionDetails.Insert(Convert.ToInt64(Session["SaleSanctionID"].ToString()), txtlotno.Text, txtsaleprice.Text, txtemd.Text, txtremsp.Text, txtvat.Text, txtfcess.Text,txttotal.Text))
        {
            lblStatus.Text = Resources.Language.Common_Record_Add;
        }
        BindGrid(Session["Language"].ToString());
       
    }

Bussiness logic page
clsSaleSanctionDetails.cs


public class clsSaleSanctionDetails
    {
        public clsSaleSanctionDetails()
        {
        }

        public bool Insert(long SaleSanctionID, string LotNo, Double SalePrice, Double EMD_Amount, Double RemainingSalePrice, Double VAT, Double ForestDepartmentCess, Double Total)
        {
            bool res = false;
            System.Collections.ArrayList sel = new System.Collections.ArrayList();

            sel.Add("SP_tr_Sale_SanctionDetails_Insert");
            ArrayList lstParam = new System.Collections.ArrayList();

            SqlParameter param;

            param = new SqlParameter();
            param.ParameterName = "@SaleSanctionID";
            param.SqlDbType = SqlDbType.BigInt;
            param.Value = SaleSanctionID;
            lstParam.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@LotNo";
            param.SqlDbType = SqlDbType.VarChar;
            param.Value = LotNo;
            lstParam.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@SalePrice";
            param.SqlDbType = SqlDbType.Float;
            param.Value = SalePrice;
            lstParam.Add(param);

        
            param = new SqlParameter();
            param.ParameterName = "@EMD_Amount";
            param.SqlDbType = SqlDbType.Float;
            param.Value = EMD_Amount;
            lstParam.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@RemainingSalePrice";
            param.SqlDbType = SqlDbType.Float;
            param.Value = RemainingSalePrice;
            lstParam.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@VAT";
            param.SqlDbType = SqlDbType.Float;
            param.Value = VAT;
            lstParam.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@ForestDepartmentCess";
            param.SqlDbType = SqlDbType.Float;
            param.Value = ForestDepartmentCess;
            lstParam.Add(param);

            param = new SqlParameter();
            param.ParameterName = "@Total";
            param.SqlDbType = SqlDbType.Float;
            param.Value = Total;
            lstParam.Add(param);

            

            res = new eAuctionDAL.SQLDAL().UpdateTransData(sel, lstParam, false);
            return res;

        }

Error 7 Argument '4': cannot convert from 'string' to 'double'
D:\testing data\EAuction\SaleSanctionDetails.aspx.cs 117 132 D:\testing data\EAuction\
Tags: C#, ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900