narasiman man

narasiman man

  • NA
  • 0
  • 117.9k

column or table value does not match the table definition

Jun 15 2012 9:29 AM
I design and code.

when i insert the values in run time it shows the column or table value does not match the table defintion.

  Code

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection("Server=(local);initial catalog=Rental;Trusted_Connection=True");
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("insert into mis values('" + DropDownList1.SelectedItem.Text + "',' " + DropDownList2.SelectedItem.Text + "',' " + DropDownList3.SelectedItem.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "', " + DropDownList4.SelectedItem.Text + "," + TextBox3.Text + "," + TextBox4.Text + "," + TextBox5.Text + "," + TextBox6.Text + "," + TextBox7.Text + "," + TextBox8.Text + "," + TextBox9.Text + "," + TextBox10.Text + ",' " + TextBox11.Text + "',' " + TextBox12.Text + "',' " + DropDownList5.SelectedItem.Text + "')", con);
        cmd.ExecuteNonQuery();
        con.Close();
        Response.Write("Record Inserted Successfully");
    }
}


I send the code and send the design in to attach file.

please solve my problem.

Regards,
Narasiman P

Answers (1)