none
How to insert Session ID into table using asp.net? RRS feed

  • Question

  • here is my session id of user

    if (Session["EmpID"] == null)  
               {  
                   Response.Redirect("LogingForm.aspx");  
               }  

    here is my insert Record into table

    protected void tbsv_Click(object sender, EventArgs e)  
           {  
      
      
               {  
      
                   {  
      
                       if (ddlBbitem.SelectedValue == "")  
                       {  
                           Response.Write("<script>alert('Please Select Item Name')</script>");  
      
                       }  
                       else  
                           if (prdbqty.Text == "")  
                           {  
                               Response.Write("<script>alert('Please Input Weight')</script>");  
      
                           }  
      
      
                           else  
                           {  
                               con.Open();  
                               SqlCommand cmd = new SqlCommand("spInsertbigbale", con);  
                               cmd.CommandType = CommandType.StoredProcedure;  
                               // cmd.Parameters.AddWithValue("@RollNo", TextBox4.Text.Trim());  
                               cmd.Parameters.AddWithValue("@Codeitem", ddlBbitem.SelectedValue);  
      
      
                               cmd.Parameters.AddWithValue("@Bweight", prdbqty.Text.Trim());  
                               cmd.Parameters.AddWithValue("@Bpqty", opbbqty.Text.Trim());  
      
                               cmd.Parameters.AddWithValue("@CID", DDLBBCID.SelectedValue);  
                               cmd.Parameters.AddWithValue("@SecID", DDLBBsec.SelectedValue);  
      
      
                               cmd.Parameters.AddWithValue("@EntryDate", txtbpentrydate.Text);  
                               cmd.Parameters.Add("@BID", SqlDbType.Int);  
                               cmd.Parameters["@BID"].Direction = ParameterDirection.Output;   
                               cmd.ExecuteNonQuery();  
      
                               int ResultValue = Convert.ToInt32(cmd.Parameters["@BID"].Value);  
      
                               if (ResultValue > 1)  
                               {  
      
                                   Response.Redirect("BigBalePrintView.aspx?BID=" + ResultValue + "");  
                               }  
                               else  
                               {  
                                   Response.Write("<script>alert('Record Not save')</script>");  
      
      
                               }  
                               con.Close();  
      
      
      
      
                           }  
                   }  
               }  

    • Moved by CoolDadTx Wednesday, July 17, 2019 2:00 PM ASP.NET related
    Wednesday, July 17, 2019 9:11 AM

Answers

All replies