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. Multiple tables from a single DB [modified]

Multiple tables from a single DB [modified]

Scheduled Pinned Locked Moved C#
helpdatabasequestion
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.
  • S Offline
    S Offline
    Star09
    wrote on last edited by
    #1

    There seems to be a problem with my code when I try and retrieve multiple tables. Please tell me what's wrong, or if there is an alternative way to do this? Thanks in advance. OleDbConnection clsConnection; clsConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\one.mdb;"); clsConnection.Open(); //first table WTest1.oneDataSet f_table = new WTest1.oneDataSet(); OleDbDataAdapter dAdapter = new OleDbDataAdapter("SELECT * FROM first", clsConnection); dAdapter.Fill(f_table, "first"); //second table WTest1.oneDataSet s_table = new WTest1.oneDataSet(); OleDbDataAdapter dAdapter1 = new OleDbDataAdapter("SELECT * FROM second", clsConnection); dAdapter1.Fill(s_table, "second");``Runtime Error: Syntax Error in FROM Clause --Star

    modified on Wednesday, April 29, 2009 1:04 PM

    R 1 Reply Last reply
    0
    • S Star09

      There seems to be a problem with my code when I try and retrieve multiple tables. Please tell me what's wrong, or if there is an alternative way to do this? Thanks in advance. OleDbConnection clsConnection; clsConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\one.mdb;"); clsConnection.Open(); //first table WTest1.oneDataSet f_table = new WTest1.oneDataSet(); OleDbDataAdapter dAdapter = new OleDbDataAdapter("SELECT * FROM first", clsConnection); dAdapter.Fill(f_table, "first"); //second table WTest1.oneDataSet s_table = new WTest1.oneDataSet(); OleDbDataAdapter dAdapter1 = new OleDbDataAdapter("SELECT * FROM second", clsConnection); dAdapter1.Fill(s_table, "second");``Runtime Error: Syntax Error in FROM Clause --Star

      modified on Wednesday, April 29, 2009 1:04 PM

      R Offline
      R Offline
      Rolando CC
      wrote on last edited by
      #2

      And which is exactly the problem ???

      S 1 Reply Last reply
      0
      • R Rolando CC

        And which is exactly the problem ???

        S Offline
        S Offline
        Star09
        wrote on last edited by
        #3

        Runtime error: Syntax Error in FROM clause

        R 1 Reply Last reply
        0
        • S Star09

          Runtime error: Syntax Error in FROM clause

          R Offline
          R Offline
          Rolando CC
          wrote on last edited by
          #4

          Why are you using typed datasets? Can you use System.Data.DataSet datasets???

          S 1 Reply Last reply
          0
          • R Rolando CC

            Why are you using typed datasets? Can you use System.Data.DataSet datasets???

            S Offline
            S Offline
            Star09
            wrote on last edited by
            #5

            Could you explain?

            R 1 Reply Last reply
            0
            • S Star09

              Could you explain?

              R Offline
              R Offline
              Rolando CC
              wrote on last edited by
              #6

              Typed datasets: http://msdn.microsoft.com/en-us/library/esbykkzb(VS.71).aspx[^] http://www.15seconds.com/Issue/031223.htm[^] Normal datasets: declare the connection... create System.Data.Dataset: Dataset ds=new Dataset(); create OledbDataAdapter: OledbDataAdapter adapter=new OleDbDataAdapter("Select * from table1",conn); Fill ds: adapter.fill(ds,"table1"); USe it....

              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