Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Dataset/DataTable with DataGrid (local database only!)

Dataset/DataTable with DataGrid (local database only!)

Scheduled Pinned Locked Moved C#
databasetutorial
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Blubbo
    wrote on last edited by
    #1

    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:

    P 1 Reply Last reply
    0
    • B Blubbo

      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:

      P Offline
      P Offline
      Private_Void
      wrote on last edited by
      #2

      What type of database is your local database?

      B 1 Reply Last reply
      0
      • P Private_Void

        What type of database is your local database?

        B Offline
        B Offline
        Blubbo
        wrote on last edited by
        #3

        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.

        P 1 Reply Last reply
        0
        • B Blubbo

          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.

          P Offline
          P Offline
          Private_Void
          wrote on last edited by
          #4

          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.

          B 1 Reply Last reply
          0
          • P Private_Void

            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.

            B Offline
            B Offline
            Blubbo
            wrote on last edited by
            #5

            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

            P 1 Reply Last reply
            0
            • B Blubbo

              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

              P Offline
              P Offline
              Private_Void
              wrote on last edited by
              #6

              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();

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups