protected void BindVJForm() { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select Job.[Job Id],Job.[Job Name],Job.[Category],Job.[Salary],Job.[Description],Job.[Job Provider Id],[Job Provider].[Company Name],[Job Provider].[Phone] from Job INNER JOIN [Job Provider] ON Job.[Job Provider Id] = [Job Provider].[username] where Job.[Status]='Available'"; command = new SqlCommand(sql, cnn); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); VJFormView.DataSource = dt; VJFormView.DataBind(); cnn.Close(); }
protected void BindVJForm() { string connetionString; SqlConnection cnn; connetionString = @"Data Source=DESKTOP-NCLVKS1;Initial Catalog=E-Employment ;User ID=sa;Password=allohomora"; String sql; cnn = new SqlConnection(connetionString); SqlCommand command; cnn.Open(); sql = "Select * from Job where Status !='Deleted' and [Job Provider Id]=@jpid"; command = new SqlCommand(sql, cnn); command.Parameters.AddWithValue("@jpid", Session["Username"]); SqlDataAdapter sda = new SqlDataAdapter(command); DataTable dt = new DataTable(); sda.Fill(dt); VJFormView.DataSource = dt; VJFormView.DataBind(); cnn.Close(); }