|
![](/images/resource/spacer.gif) |
|
ฐานข้อมูล 2 ตัวเชื่อมต่อกันยังไง ผมมีฐานข้อมูล 2 ตัว คือ ฐานข้อมูลของนักศึกษา(Student_CenterDB) ซึ่งเ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
'Database 1 (Student_AffairsDB)
<%
keyword = Request.Form("keyword")
Set strConn_1 = Server.CreateObject("ADODB.Connection")
strConn_1.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.mappath("your_database1.mdb")
strSQL = "Select * from SomeTable Where field_id like '%"& keyword &"%' "
Set strRS_1 = Server.CreateObject("ADODB.Recordset")
strRS_1.Open strSQL,strConn_1, 1, 3
%>
'แสดงข้อมูล Database 1
<%
=strRS_1("SomeField")
%>
' ปิด strRS_1 และ strConn_1
<%
strRS_1.Close
strConn_1.CLose
Set strRS = Nothing
Set strConn = Nothing
%>
'Database 2 (Student_CenterDB)
<%
Set strConn_2 = Server.CreateObject("ADODB.Connection")
strConn_2.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.mappath("your_database1.mdb")
strSQL = "Select * From SomeTable Order by Student_CenterDBID=" & keyword 'รับมาจาก keyword ของ Database 1 (Student_AffairsDB)
Set strRS_2 = Server.CreateObject("ADODB.Recordset")
strRS_2.Open strSQL,strConn_2, 1, 3
%>
'แสดงข้อมูลของ น.ศ. จาก Database 2 (Student_CenterDB)
<%
=strRS_2("SomeField")
%>
' ปิด strRS_2 และ strConn_2
<%
strRS_2.Close
strConn_2.CLose
Set strRS = Nothing
Set strConn = Nothing
%>
*** ID ของ Student_AffairsDB กับ Student_CenterDB ต้องมีความสัมพันธ์กันด้วยนะครับ
*** หากตอบไม่ตรงจุดที่ต้องการ ยังไงขอโทษด้วยนะครับ ![](/images/old_resource/o06.gif?v=1001)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
4 ธ.ค. 2548 14:34:39 |
By :
entaneer_th |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ขอบคุณพี่มากครับ ถ้าไม่ได้พี่ผมคงเอาตารางมารวมกันในฐานข้อมูลเดียวกันแล้วครับ ขอบคุณเป็นอย่างยิ่งครับ
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
5 ธ.ค. 2548 09:47:20 |
By :
AkeInta |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|