private void vfind_SelectedIndexChanged(object sender, EventArgs e) { Vbtnsave.Visible = false; SqlDataAdapter da = new SqlDataAdapter("select * from VisitorPass where PassNo ='" + vfind.SelectedValue.ToString() + "'", objConn1); DataSet ds = new DataSet(); da.Fill(ds, "VisitorPass"); if (ds.Tables["VisitorPass"].Rows.Count > 0) { MainCombo.SelectedValue = ds.Tables["VisitorPass"].Rows[0]["PassType"].ToString(); txtvpassno.Text = ds.Tables["VisitorPass"].Rows[0]["PassNo"].ToString(); VdateTimePicker1.Value = Convert.ToDateTime(ds.Tables["VisitorPass"].Rows[0]["Date"].ToString()); Dttimein.Value = Convert.ToDateTime(ds.Tables["VisitorPass"].Rows[0]["Timein"].ToString()); Dttimeout.Value = Convert.ToDateTime(ds.Tables["VisitorPass"].Rows[0]["Timeout"].ToString()); txtvpassno.Text = ds.Tables["VisitorPass"].Rows[0]["VisitorsName"].ToString(); txtvpassno.Text = ds.Tables["VisitorPass"].Rows[0]["Purpose"].ToString(); txtvpassno.Text = ds.Tables["VisitorPass"].Rows[0]["ToSee"].ToString(); vauthcombo.SelectedValue = ds.Tables["VisitorPass"].Rows[0]["AuthorisedSign"].ToString(); } }
SqlDataAdapter da = new SqlDataAdapter("select * from VisitorPass where PassNo = @PassNo", objConn1);da.SelectCommand.Parameters.AddWithValue("@PassNo", vfind.SelectedValue);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)