Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
GeneralRe: Multiple forms and datagridviews Pin
bwood202026-May-09 4:08
bwood202026-May-09 4:08 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute26-May-09 4:15
Henry Minute26-May-09 4:15 
GeneralRe: Multiple forms and datagridviews Pin
bwood202026-May-09 6:13
bwood202026-May-09 6:13 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute26-May-09 6:20
Henry Minute26-May-09 6:20 
GeneralRe: Multiple forms and datagridviews Pin
bwood202026-May-09 12:47
bwood202026-May-09 12:47 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute26-May-09 13:11
Henry Minute26-May-09 13:11 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute26-May-09 13:18
Henry Minute26-May-09 13:18 
GeneralRe: Multiple forms and datagridviews [modified] Pin
bwood202027-May-09 5:44
bwood202027-May-09 5:44 
Hi Henry,

Looks like I have added all the code I need and the code compiles without warnings but the dgv doesn't get populated. I belive the only place I needed to add code too is here. If I am wrong then please advise further.

private void ProcessMods()
          {
               // Create a copy of original table structure with
               // standardized column names**
               // load original file data into it
               // then do a series of updates using the docsDictionary, and the
               // other Dictionaries
               // STEP THROUGH THIS TO WATCH UPDATE STATEMENT BUILDING
               StringBuilder selectBuilder = null;
               foreach (string key in this.docsDictionary.Keys)
               {
                    foreach (string val in this.docsDictionary[key])
                    {
                         selectBuilder = new StringBuilder();
                         selectBuilder.Append("UPDATE TestData SET Documentation = ");
                         selectBuilder.Append(key);
                         selectBuilder.Append(" WHERE Documentation = ");
                         selectBuilder.Append(val);

                         string updateQuery = selectBuilder.ToString();

                         // execute the query here
                         // you know OleDbConnection, OleDbcommand etc.
                         // then go round for next mod

                                                            //This is where I added the connection
                              DataTable dFill = null;
                              String comString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path.GetDirectoryName(Path.GetFullPath(this.dataFile)) + @";Extended Properties=""Text;HDR=YES;FMT=Delimited;IMEX=1\""";
                              using (OleDbConnection conCSV = new OleDbConnection(comString))
                              {
                                    conCSV.Open();
                                    OleDbCommand dbCommand = new OleDbCommand(updateQuery, conCSV);
                                    OleDbDataAdapter dAdapter = new OleDbDataAdapter(dbCommand);
                                    dFill = new DataTable();
                                    dAdapter.Fill(dFill);
                              }
                              bindingSource1.DataSource = dFill;
                              dataGridView1.DataSource = bindingSource1;
                    }
                    // go round for next key
                       
               }

               // then do same for next dictionary
          }

Do I need to add code for a ShowDialog and capture the full path of the file? Also, the test file is in the debug folder. Maybe it would be easier to hardcode the path of the file in the com string. What do you think?

Thank you,

Brenton

modified on Wednesday, May 27, 2009 11:50 AM

GeneralRe: Multiple forms and datagridviews Pin
Henry Minute27-May-09 7:20
Henry Minute27-May-09 7:20 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute27-May-09 10:41
Henry Minute27-May-09 10:41 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute27-May-09 11:39
Henry Minute27-May-09 11:39 
GeneralRe: Multiple forms and datagridviews Pin
bwood202027-May-09 12:18
bwood202027-May-09 12:18 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute27-May-09 12:29
Henry Minute27-May-09 12:29 
GeneralRe: Multiple forms and datagridviews Pin
Henry Minute27-May-09 12:35
Henry Minute27-May-09 12:35 
GeneralRe: Multiple forms and datagridviews Pin
bwood202027-May-09 13:02
bwood202027-May-09 13:02 
GeneralRe: Multiple forms and datagridviews Pin
bwood202029-May-09 5:27
bwood202029-May-09 5:27 
GeneralRe: Multiple forms and datagridviews Pin
bwood202018-Jun-09 12:06
bwood202018-Jun-09 12:06 
QuestionCheck if frame in webclient is done loading Pin
Member 441789215-May-09 4:25
Member 441789215-May-09 4:25 
Questionposting data to remote URL using WebBrowser Pin
shabya15-May-09 2:49
shabya15-May-09 2:49 
QuestionConvert EBCDIC to ASCII and vice versa Pin
deep715-May-09 2:15
deep715-May-09 2:15 
AnswerRe: Convert EBCDIC to ASCII and vice versa Pin
OriginalGriff15-May-09 2:23
mveOriginalGriff15-May-09 2:23 
GeneralRe: Convert EBCDIC to ASCII and vice versa Pin
deep715-May-09 2:39
deep715-May-09 2:39 
GeneralRe: Convert EBCDIC to ASCII and vice versa Pin
Alan Balkany15-May-09 3:31
Alan Balkany15-May-09 3:31 
AnswerRe: Convert EBCDIC to ASCII and vice versa Pin
Scott Barbour15-May-09 9:59
Scott Barbour15-May-09 9:59 
GeneralRe: Convert EBCDIC to ASCII and vice versa Pin
ishtine188-Jan-10 19:04
ishtine188-Jan-10 19:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.