Dataset/DataTable with DataGrid (local database only!)
-
I'm trying to find good example for DataGrid (could be with DataSet example) with local database... I do not want example with SQLserver (which I have seen in many 'net sites), just local database. Thanks!:confused:
What type of database is your local database?
-
What type of database is your local database?
I'm looking into simple 2 columns (name of variable, and Interpreted Data)... the interpreted data would be the translation of the raw hex data from a raw data line on file. Since that there are many lines (could be up to 3000 lines in all), wonder if I could set up the dataset to work with datagrid so i can view the data page by page by clicking "next" button? Hope that clears up.
-
I'm looking into simple 2 columns (name of variable, and Interpreted Data)... the interpreted data would be the translation of the raw hex data from a raw data line on file. Since that there are many lines (could be up to 3000 lines in all), wonder if I could set up the dataset to work with datagrid so i can view the data page by page by clicking "next" button? Hope that clears up.
I am beginning to understand what your datasource is / looks like. Could you please send me an example of a row of data or two rows of data and I am sure I can assist you.
-
I am beginning to understand what your datasource is / looks like. Could you please send me an example of a row of data or two rows of data and I am sure I can assist you.
Ok.. to clarify what the datasource looks like... (both are string value). I'm not sure how to set up the dataset so i can look on the next set of data. from the first row of raw data would have: Name Interpreted_Value Color_Used Cyan Install_Date 12/21/99 Error_Code 848-323 Next row from raw data: Name Interpreted_Value Color_Used Magenta Install_Date 3/21/93 Error_Code 239-772 Next row from raw data: Name Interpreted_Value Color_Used Magenta Install_Date 1/2/03 Error_Code None
-
Ok.. to clarify what the datasource looks like... (both are string value). I'm not sure how to set up the dataset so i can look on the next set of data. from the first row of raw data would have: Name Interpreted_Value Color_Used Cyan Install_Date 12/21/99 Error_Code 848-323 Next row from raw data: Name Interpreted_Value Color_Used Magenta Install_Date 3/21/93 Error_Code 239-772 Next row from raw data: Name Interpreted_Value Color_Used Magenta Install_Date 1/2/03 Error_Code None
The data in file C:\DataSource.txt from code Looks exactly like below.... Magenta,1/2/03,XDSDF Blue,1/2/05,None //I know this is kind of messy but i just slapped it together. let me know if you have any questions. StreamReader s; string[] columns = {"Color_Used","Install_Date","Error_Code"}; DataSet ds = new DataSet(); grvMain.DataSource = ds; ds.Tables.Add("tblMain"); for (int i = 0; i < columns.Length; i++) { ds.Tables["tblMain"].Columns.Add(columns[i]); } string sFieldDelimiter = ","; string sRowDelimiter = "\r\n"; s = new StreamReader(@"C:\DataSource.txt"); string sAllData = s.ReadToEnd(); string[] sRowsColSplit = sAllData.Split(sRowDelimiter.ToCharArray()); foreach (string row in sRowsColSplit) { if (row != "") { string[] rows = row.Split(sFieldDelimiter.ToCharArray()); ds.Tables["tblMain"].Rows.Add(rows); } } grvMain.DataBind();