calling a field and replace
I am trying to call/isolate the field InspectionSummary.InspectionSummaryDate so I can do a Replace on it. Basically replace all "-" with "/".
I can't seem to be able to do a Replace from the SQL. I am wondering how in Section #1 or #2 I could
reformat the field value before it appears in the StackPanel.
#1
private void FillDataGrid()
{
ArrayList permitTypes = new ArrayList();
permitTypes = control.GetSummaryTypes(currentJobID);
if (permitTypes.Count > 0)
{
for (int i = 0; i < permitTypes.Count; i++)
{
//Get the summaries for each type
DataView dv = control.GetSummary(currentJobID, permitTypes[i].ToString());
//Check to see if there are rows and if so add the Panel
if (dv.Table.Rows.Count > 0)
{
Expander ex1 = new Expander();
ex1.Header = permitTypes[i].ToString();
DataGrid dgList = new DataGrid();
ex1.Content = dgList;
dgList.ItemsSource = dv;
b8Panel.Children.Add(ex1);
//Draw a line between each card dropdown expander panel
Line line = new Line();
line.X1 = 0;
line.X2 = ex1.ActualWidth - 1;
line.Y1 = 0;
line.Y2 = ex1.ActualHeight - 1;
line.Stroke = Brushes.Black ;
line.StrokeThickness = 2;
b8Panel.Children.Add(line);
}
}
}
}
#2
public DataView GetSummary(int jobID, string permitType){
//Set the DBCommand object
DataSet jobDataSet = null;
IDataParameter[] paramCollection = new IDataParameter[2];
OleDbParameter p_JobID = new OleDbParameter("JobID", jobID);
paramCollection[0] = p_JobID;
OleDbParameter p_permitType = new OleDbParameter("PermitType", permitType);
paramCollection[1] = p_permitType;
jobDataSet = db.ExecuteDataSet(GET_SUMMARY_LIST, CommandType.Text, paramCollection);
return jobDataSet.Tables[0].DefaultView;
}
#3
const string GET_SUMMARY_LIST = "SELECT InspectionSummary.InspectionType, InspectionSummary.Status, " +
"InspectionSummary.Inspector, left(InspectionSummary.InspectionSummaryDate,10) as Dates " +
"FROM InspectionType INNER JOIN InspectionSummary ON InspectionType.InspectionTypeName = InspectionSummary.InspectionType" +
"WHERE InspectionSummary.JobID=@JobID AND InspectionSummary.PermitType=@PermitType ORDER BY InspectionSummary.InspectionSummaryDate;";