title: Conversion failed when converting the nvarchar value to data type int
body: <p>I am getting the error of conversion failed in my codebehind. My code is below:</p>
  
  <pre><code>using (SqlCommand cmd = new SqlCommand((tempUsertype == "0" ? "Select * from tbl_students" : "Select * from tbl_students where Id in (Select Id from tbl_students where NgoId=@NgoId)"), conn))
  {
      cmd.Parameters.AddWithValue("@NgoId", Convert.ToString(Session["User"]));
      SqlDataAdapter da = new SqlDataAdapter(cmd);
      DataSet ds = new DataSet();
      da.Fill(ds);
      ddlStudent.DataValueField = ds.Tables[0].Columns["Id"].ToString();
      ddlStudent.DataTextField = ds.Tables[0].Columns["first_name"].ToString();
      ddlStudent.DataSource = ds.Tables[0];
      ddlStudent.SelectedIndex = 0;
  
      if (Session["UserType"] == "1" || Session["UserType"] == "2")
      {
          ddlStudent.Enabled = false;
      }
      else
      {
          ddlStudent.Items.Insert(0, new ListItem() { Text = "--Select NGO--", Value = "0" });
          ddlStudent.Enabled = true;
      }
  }
  </code></pre>
  
  <p>I'm getting following error:</p>
  
  <blockquote>
    <p>Conversion failed when converting the nvarchar value  to data type int.</p>
  </blockquote>
  
  <p>What changes has to be done here?</p>