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. Need to Import table & query from one MS Access databas to another.

Need to Import table & query from one MS Access databas to another.

Scheduled Pinned Locked Moved C#
databasehelp
3 Posts 3 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.
  • H Offline
    H Offline
    honeyashu
    wrote on last edited by
    #1

    Hi All, I have to import a table & a Query from c:\Programfile\asd\MyProject\test.mdb to c:\document&settings\ applicationdata\test.mdb. I have created & established the Connection string & all. the only thing i am not getting is Query needed to pass... Please help..

    D M 2 Replies Last reply
    0
    • H honeyashu

      Hi All, I have to import a table & a Query from c:\Programfile\asd\MyProject\test.mdb to c:\document&settings\ applicationdata\test.mdb. I have created & established the Connection string & all. the only thing i am not getting is Query needed to pass... Please help..

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      Well you should post it in the DB forum/section. Anyway here's one way how you could do it(the query):

      OleDbCommnand cmd = new OledbCommand(con);

      //create a Select for example
      cmd.CommandText = "CREATE PROC nameOfQueryHere(inName VARCHAR(50))
      AS SELECT * FROM tblNameHere
      WHERE tblNameHere.Name = inName";

      //and create the query/proc by executing the command

      cmd.ExecuteNonQuery();

      Of course try catch and all that is up to you. I just posted an ideea. [EDIT]The same technique for creating a table. Use a command string in witch you create the table and execute it[/EDIT]

      modified on Monday, February 1, 2010 9:07 AM

      1 Reply Last reply
      0
      • H honeyashu

        Hi All, I have to import a table & a Query from c:\Programfile\asd\MyProject\test.mdb to c:\document&settings\ applicationdata\test.mdb. I have created & established the Connection string & all. the only thing i am not getting is Query needed to pass... Please help..

        M Offline
        M Offline
        Md Marufuzzaman
        wrote on last edited by
        #3

        Well....You don't mention your destination specifically, Try this link Import Data to SQL Server from Excel or Access using TSQL Script[^]

        Thanks Md. Marufuzzaman


        I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.

        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