0
  1. How to create effective ajax table in asp.net

  2. Having problem in adding data from dropdown list and saving it in sql server
    (a). In my .aspx web page i have
    First Name
    Last Name
    Gender
    Email

    (b) Gender is taken by dropdown list
    (c) When you run the code male/female should save to Sql database server
    following is the code

            SqlConnection SqlConn = new SqlConnection();
            SqlConn.ConnectionString = ConfigurationManager.AppSettings["SqlConn"].ToString();
            SqlConn.Open();
            cmd = new SqlCommand("insert into tbl_info values('" + "" + txt_firstname.Text + "','" + txt_lastname.Text + "','" + dpl_gender.SelectedItem.Text +  "','" + txt_email.text + "')", SqlConn);
            cmd.ExecuteNonQuery();
    

Now i am getting an error please can anyone identify what is the error

Error is: String or binary data would be truncated. The statement has been terminated.
Red Line on: cmd.ExecuteNonQuery();

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by hericles
0

One of your inputs is too long for the corrosponding column in the database, check the allowable lengths for them all to see which one is the problem.

As for your first question, what is an effective AJAX table? What are you trying to do?

Edited by hericles

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.