Name Mame

Name Mame

  • 1.6k
  • 160
  • 3.2k

session value in anaother panel in the same page

Jan 18 2023 8:13 AM

 Hi,

I am designing a web form and one of its pages is divided into two parts. The first section is stored in the data base and returns to me a number that I store in a session to use later by adding new data to the same record..and when writing the code and executing the program, the following message appears:

(System.ArgumentException: 'No mapping exists from object type System.Web.UI.WebControls.ListItem to a known managed provider native type.'
)

  protected void AddVisitor_Click(object sender, EventArgs e)
        {

            using (SqlConnection connection = new SqlConnection(connoctionString))
            {
                using (SqlCommand command = new SqlCommand("AddVisitor", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    connection.Open();
                    //command.Parameters["@VisitID"].Direction = ParameterDirection.Output;
                    command.Parameters.AddWithValue("@VisitID", (string)Session["VisitID"]);
                    command.Parameters.AddWithValue("@Visitor_name", VisitorName.Text);
                    command.Parameters.AddWithValue("@Nationality_ID", NationalDD.SelectedItem);
                    command.Parameters.AddWithValue("@org_id", Org.SelectedValue);
                    command.ExecuteNonQuery();
                    connection.Close();

can any one help me?


Answers (9)