Hi,
Good Morning,
I have a reqiurement,
i,e i need to connect multiple access databases with a single common field, in asp.net, how to connect and the steps please tell to me..
Thanks
How to connect multiple access databases in asp.net?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Satyaveer Chauhan9 pointsPosted Aug 26, 2012, 10:56 PM EDT
SqlConnection con1 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con1"].ConnectionString); SqlConnection con2 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con2"].ConnectionString); SqlCommand cmd = new SqlCommand("select * from table1", con1); SqlDataReader dr; con1.Open(); dr = cmd.ExecuteReader(CommandBehavior.SingleResult); while (dr.Read()) { // .... }dr.Close() //your condition then fire insert commnd with connection con2 SqlCommand insertcmd = new SqlCommand("insert into table2", con2); SqlDataAdapter dap = new SqlDataAdapter(insertcmd);Akkiraju IvaturiRank #474 · 5.2K pointsPosted Aug 26, 2012, 11:02 PM EDT
Command object should be general for any connection. Which ever connection you would like to use, set the connection for the Command object to that particular connection.