how to connect data on two DB ?

Results 1 to 5 of 5

Thread: how to connect data on two DB ?

  1. #1
    znM Guest

    Default how to connect data on two DB ?

    anyone can help me?<BR>my problem is (more complex connectivity actually):<BR>Access DB <BR>db1.mdb have a table named User<BR>User have fields :<BR>id/ UserName/ address/<BR><BR>db2.mdb have a table named salary<BR>salary have fields :<BR>id/ UserID / Salary/<BR><BR>field &#039;UserID&#039; on &#039;salary&#039; table in db2.mdb <BR>have some datas come from <BR>field &#039;ID&#039; on table &#039;User&#039; in db1.mdb<BR>i want make a simple report that have structure like this :<BR><BR>UserName / Salary<BR><BR>plz hlp .....

  2. #2
    Bailey Guest

    Default RE: how to connect data on two DB ?

    Create two recordsets and call from each of them simultaneously for whatever is required. RS1("UserName") & RS2("Salary")

  3. #3
    znM Guest

    Default RE: Is that way can slow down ASP page?

    thanks a lot, that&#039;s great idea<BR>but I should create some connection object and many recordset object (if I want retrieve datas from many tables and DB), <BR>don&#039;t I ?<BR>IS that can slow down my ASP page performance ?<BR>thank&#039;s for your attention ... :)

  4. #4
    Bailey Guest

    Default RE: Is that way can slow down ASP page?

    Yes, create two connection object to your two different databses and two different recordsets. You could alternately close and open the two different recordsets if you want. I guess it all depends on how worried about performance you are. If this is a low volume site it shouldn&#039;t be a big deal either way. I don&#039;t think you can get away from opening two connection objects. You could also open your first connection and recordset and put all of that info in an array and then close the connection and recordset and then open your other recordset. Not sure which would be better. Cheers.

  5. #5
    znM Guest

    Default RE: Is that way can slow down ASP page?

    I have a new solution (in MS Access):<BR>Open one DB an go to File,Get external data,Link tables<BR>and then I choose some tables from other DB . Now, I&#039;ve tables from other DB inserted to my first DB.<BR> Set conn = Server.CreateObject("ADODB.Connection")<BR> conn.Open "bla..bla..bla"<BR> Set rs= Server.CreateObject("ADODB.RecordSet") <BR> <BR>SQL :<BR>strSQL = "SELECT a.Field1, a.Field2, a.Field3, b.Field1, b.Field2, b.Field3,b.Field4<BR>FROM table1 AS a, table1 AS b<BR>WHERE (((a.Field1)=[b].[Field1]) AND ((a.Field2)=[b].[Field2]) AND ((a.Field3)=[b].[Field3]) AND ((b.Field4)=&#039;somestring&#039;))"<BR><BR>rs.op en strSQL ,conn<BR> <BR>So with this way I only create 1 (one) connection and 1(one)<BR>recordset to proccess some tables (using alias in SQL).<BR>Is that good idea ? For coding ,this idea is more quick and efficient but I&#039;m not sure about its performance<BR>According to you, which one is faster to retrieve,process and display datas?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts