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. Web Development
  3. ASP.NET
  4. how to fill DataAdapter when two tables are being used+ASP.Net

how to fill DataAdapter when two tables are being used+ASP.Net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasesysadmintutorial
2 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.
  • M Offline
    M Offline
    mavii
    wrote on last edited by
    #1

    i am providing the code below string strcon = "Provider=SQLOLEDB;Server=(local);Database=rescue15;uid=sa;pwd=sasa;"; OleDbConnection conn = new OleDbConnection(strcon); string q = "SELECT crime_mgmt.cr_location 'Crime Location',crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue"; OleDbCommand cmd = new OleDbCommand(q, conn); conn.Open(); DataSet ds = new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(cmd); da.Fill(ds, "offensive_issue"); da.Fill(ds, "crime_mgmt");

    M 1 Reply Last reply
    0
    • M mavii

      i am providing the code below string strcon = "Provider=SQLOLEDB;Server=(local);Database=rescue15;uid=sa;pwd=sasa;"; OleDbConnection conn = new OleDbConnection(strcon); string q = "SELECT crime_mgmt.cr_location 'Crime Location',crime_mgmt.cr_date,offensive_issue.c_desc FROM crime_mgmt,offensive_issue"; OleDbCommand cmd = new OleDbCommand(q, conn); conn.Open(); DataSet ds = new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(cmd); da.Fill(ds, "offensive_issue"); da.Fill(ds, "crime_mgmt");

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Just wrote one line instead of two... then, you will get the all records from both tables.

      mavii wrote:

      da.Fill(ds, "bothtable");

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

      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