Calling a field and replace
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Calling a field and replace

Threaded View

  1. #1
    Join Date
    Apr 2009
    Posts
    12

    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
    Code:
    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
    Code:
    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
    Code:
      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;";
    Last edited by gstercken; May 15th, 2009 at 05:19 AM. Reason: Added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center