All pastes #393868 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-13 21:58 UTC
rendered paste body
private void ViewStatus(string strStatus)
		{
			// SQL Connection
			SqlConStr strSqlConnection = new SqlConStr();
			SqlConnection connection = new SqlConnection(strSqlConnection.GetString() );

			DataSet ds = new DataSet();

			try
			{
				connection.Open();

				SqlCommand command = new SqlCommand("spWvGetIdmRecordRemarks", connection);
				command.CommandType = CommandType.StoredProcedure;
				command.Parameters.Add("@Status", strStatus);
				command.CommandTimeout = int.Parse(ConfigurationSettings.AppSettings["SelectTimeout"]);
				
				SqlDataAdapter adapter = new SqlDataAdapter(command);
				adapter.Fill(ds);
			
				//ds.Tables[0].Columns.Remove("X");

				if(ds.Tables[0].Rows.Count > 0)
				{
					lblErr.Text = string.Empty;

					dgrIdm.HeaderStyle.Font.Bold = true;
					dgrIdm.DataSource = ds;
					dgrIdm.DataBind();
					
					DoubleGroupColumn(dgrIdm, 2);

					dgrIdm.Visible = true;
				}
				else
				{
					dgrIdm.Visible = false;
					lblErr.Text = "No Records Found";
				}
			}
			catch(Exception e)
			{
				lblErr.Text = e.Message;
			}
			finally
			{
				connection.Close();
			}
		}