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