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 4236924
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:42:21+00:00 2026-05-21T02:42:21+00:00

Possible Duplicate: Asp.net how to correct the error I’m designing my web page using

  • 0

Possible Duplicate:
Asp.net how to correct the error

I’m designing my web page

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data.sqldbType.Nvarchar;

    namespace photoshops
        {
 public partial class WebForm1 : System.Web.UI.Page
   {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        onflbload(sender, e);
    }
    public void onflbload(object sender, EventArgs e)
    {
        // Create a byte[] from the input file

        int len = flbload.PostedFile.ContentLength;
        byte[] pic = new byte[len];
        flbload.PostedFile.InputStream.Read(pic, 0, len);
        // Insert the image and comment into the database

        SqlConnection connection = new SqlConnection(@"Data Source=DEVI\SQLEXPRESS; 
                          Initial Catalog =cat; Integrated Security=SSPI");

        try
        {
            connection.Open();
            SqlCommand cmd = new SqlCommand("insert into tblphotosetting "
             + "

(BillNo,CustomerName,Address,StartDate,EndDate,Systemurl,Numberofcopies,Amount,Total ) 
 values (@BillNo,@CustomerName,@Address,@StartDate,@EndDate,@Systemurl,@Numberofcopies,@Amount,@Total)", connection);
            cmd.Parameters.Add("@BillNo", SqlDbType.NVarChar).Value = TextBox1.Text;
            cmd.Parameters.Add("@CustomerName", SqlDbType.NVarChar).Value = 
      TextBox2.Text;
            cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = TextBox3.Text;
            cmd.Parameters.Add("@StartDate", SqlDbType.NVarChar).Value = 
   Rdbsdate.SelectedDate;
            cmd.Parameters.Add("@EndDate", SqlDbType.NVarChar).Value =   
    Rdbddate.SelectedDate;
            cmd.Parameters.Add("@Systemurl", SqlDbType.Image).Value = pic;
            cmd.Parameters.Add("@Numberofcopies", SqlDbType.NVarChar).Value = 

                            TextBox7.Text;
          cmd.Parameters.Add("@Amount", SqlDbType.NVarChar).Value = TextBox8.Text;
          cmd.Parameters.Add("@Total", SqlDbType.NVarChar).Value = TextBox9.Text;




            cmd.ExecuteNonQuery();
        }

        finally
        {
            connection.Close();
        }
    }
}
}

My error is
image are not insert

  • 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-21T02:42:22+00:00Added an answer on May 21, 2026 at 2:42 am

    I think you want SqlDbType instead of sqldbtype

    More info here

    using System.Data.sqldbType.Nvarchar;

    cmd.Parameters.Add("@BillNo", SqlDbType.NVarChar).Value = TextBox1.Text;
    cmd.Parameters.Add("@CustomerName", SqlDbType.NVarChar).Value =TextBox2.Text;
    cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value =TextBox3.Text;
    cmd.Parameters.Add("@StartDate", SqlDbType.NVarChar).Value = Rdbsdate.SelectedDate;
    cmd.Parameters.Add("@EndDate", SqlDbType.NVarChar).Value =Rdbddate.SelectedDate;
    cmd.Parameters.Add("@Systemurl",SqlDbType.Image).Value= pic;
    cmd.Parameters.Add("@Numberofcopies", SqlDbType.NVarChar).Value=TextBox7.Text;
    cmd.Parameters.Add("@Amount", SqlDbType.NVarChar).Value = TextBox8.Text;
    cmd.Parameters.Add("@Total",SqlDbType.NVarChar).Value= TextBox9.Text;
    
    cmd.ExecuteNonQuery();
    

    It appears as though you are trying to save a byte[] to your table ‘tblphotosetting’ but the corresponding field in the table (Systemurl) is expecting an item of data of type varchar. You need to decide what you actually want to save in that field and either adjust the table schema, or the database code.

    So the desire is in fact to store an image in the systemUrl field of the table ‘tblphotosetting’. This field is currently a varchar so will need to be of type ‘Image’. The following SQL script will make this change.

    alter table tblphotosetting 
        alter column Systemurl image null
    

    Also there has been a bit of a theme in this question answer session whereby casing has not been used correctly in this C# code, therefore I would suggest that if an IDE is not already being used, then one can download and use Visual Studio Express for free.

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

Sidebar

Related Questions

Possible Duplicate: Biggest advantage to using ASP.Net MVC vs web forms maybe it feels
Possible Duplicate: Biggest advantage to using ASP.Net MVC vs web forms I'm soon gonna
Possible Duplicate: How do I publish a Asp.net web application using MSBuild? I have
Possible Duplicate: ASP.NET: Web Site or Web Application? I have noticed that there is
Possible Duplicate: Using ASP.NET Controls without databinding My previous question yielded few results so
Possible Duplicate: How to prevent an ASP.NET application restarting when the web.config is modified?
Possible Duplicate: Client Id for Property (ASP.Net MVC) In my View I'm using jquery
Possible Duplicate: Asp.net MVC page is giving Mime type warnings for image files I
Possible Duplicate: HttpWebResponse: closing the stream Using ASP.NET is it possible to make a
Possible Duplicate: VS 2010 Web Service project template missing? I'm wondering why Asp.Net Web

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.