Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6037815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:07:44+00:00 2026-05-23T06:07:44+00:00

I have designed my web page but I get the error below. How to

  • 0

I have designed my web page but I get the error below. How to clear error?

My code

 protected void btnSave_Click(object sender, EventArgs e)
 {
        Int32 st;
        int len = browseFilepath.PostedFile.ContentLength;
        byte[] pic = new byte[len];
        browseFilepath.PostedFile.InputStream.Read(pic, 0, len);

        SqlCommand Cmd = new SqlCommand();
        SqlConnection Cnn = new SqlConnection();
        string ConnectionString;
        ConnectionString = ConfigurationManager.ConnectionStrings["PhotostudioConnectionString"].ConnectionString;

        Cnn.ConnectionString = ConnectionString;
        if (Cnn.State != ConnectionState.Open)
            Cnn.Open();
        Cmd.Connection = Cnn;
        Cmd.CommandType = CommandType.StoredProcedure;
        Cmd.CommandText = "sproc_Ins_PhotoSettingsDetails";
        Cmd.Parameters.Clear();
        // Cmd.Parameters.AddWithValue("@Id", txtBillNo.Text);
        Cmd.Parameters.AddWithValue("@Name", txtCName.Text);
        Cmd.Parameters.AddWithValue("@Phoneno", txtPhone.Text);
        Cmd.Parameters.AddWithValue("@Startdate", rdStartDate.SelectedDate);
        Cmd.Parameters.AddWithValue("@Enddate", rdEndDate.SelectedDate);
        Cmd.Parameters.Add("@Systemurl", SqlDbType.Image).Value = pic;
        SqlParameter Src = new SqlParameter("@FilePath", SqlDbType.NVarChar, 450);
        Src.Value = browseFilepath.PostedFile.FileName;
        Cmd.Parameters.Add(Src);
        Cmd.Parameters.AddWithValue("@Size", cmbSize.SelectedItem.Text  );
        Cmd.Parameters.AddWithValue("@Amount",txtAmt.Text);
        Cmd.Parameters.AddWithValue("@Extracopies", txtNoofcopies.Text);
        Cmd.Parameters.AddWithValue("@Examount",TextBox1.Text );
        Cmd.Parameters.AddWithValue("@Lamination", Ddl.SelectedItem.Text  );
        Cmd.Parameters.AddWithValue("@Laamount", txtlami.Text );
        Cmd.Parameters.AddWithValue("@Total", txtTot.Text );
        Cmd.Parameters.AddWithValue("@Grandtotal", txtgrandtot.Text );
        Cmd.Parameters.AddWithValue("@Paidamount", txtPaid.Text);
        Cmd.Parameters.AddWithValue("@Balance", txtbalance.Text );

        try
        {
            st = Convert.ToInt32(Cmd.ExecuteScalar());
        }
        catch (Exception ex)
        {
            throw new ApplicationException(
                "!!! An Error Occured While getting Data From Hdr_AccountType." + ex.Message);
            lblError.Visible = true;
            lblError.Text = "!!! An Error Occured While " + ex.Message.ToString();
            return;
        }

        Cmd.Dispose();

The error

An error occurred while getting data from Hdr_AccountType. Error converting data type nvarchar to numeric.

My stored procedure:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[sproc_Ins_PhotoSettingsDetails]
    (
     --@Id as Numeric(18,0),
     @Name as Varchar(100),
     @Phoneno as Numeric(18,0),
     @Startdate as DateTime,
     @Enddate as  DateTime,
     @Systemurl as  Image,
     @FilePath as NVarchar(450),
     @Size as nvarchar(50),
     @Amount as numeric(18,0),
     @Extracopies as numeric(18,0),
     @Examount as numeric (18,0),
     @Lamination as numeric(18,0),
     @Laamount as numeric(18,0),
     @Total as numeric(18,0),
     @Grandtotal as numeric (18,0),
     @Paidamount as Numeric(18,0),
     @Balance as numeric (18,0)
    )     
AS
BEGIN
    INSERT INTO tblPhotosettingsMaster (Name, Phoneno, Startdate, Enddate, 
                                        Systemurl, FilePath, Size, Amount, 
                                        Extracopies, Examount, Lamination, Laamount,
                                        Total, Grandtotal, Paidamount, Balance)
    VALUES (@Name, @Phoneno, @Startdate, @Enddate,
            @Systemurl, @FilePath, @Size, @Amount,
            @Extracopies, @Examount, @Lamination, @Laamount,
            @Total, @Grandtotal, @Paidamount, @Balance)

    SELECT @@Identity
END
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:07:45+00:00Added an answer on May 23, 2026 at 6:07 am

    I think your issue is that the data you’re sending into your stored procedure is sent as text (.Text = nvarchar), but your SP is assuming numeric input parameters. In most cases I think SQL will convert a string of numbers to numeric on its own, but let’s assume your txtgrandtot.Text is actually “$123.23” then you would get this error. The exception is not raised by your C# code, it’s raised by SQL Server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have designed a new web site. I have hosted it online. I want
I have Designed the Javascript function My.js it contains following code My.js function display(){
I have designed a tabbed page. I'm able to load forms in the tabs
I have designed a custom section handler before but I'm faced with a problem
i have a set of web pages specifically designed to run on iPhones (using
I 'm new to the asp.net. I have created one web page in that
I've designed a web page in asp.net. And in that page i placed html
I have recently designed a web application that I would like to write in
I have some code which utilizes parameterized queries to prevent against injection, but I
I have a page designed with many HTML Tables which are hidden or displayed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.