|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi there,
I could really do with a stear in the right direction, as I think I am using really messy methods of creating multiple connections to databases... and not quite doing it in the correct way... I have been using the following method EXAMPLE 1 set conex7 = Server.CreateObject("ADODB.Connection") dns7 = "Driver={SQL Server};" & _ "Server=217.76.131.33;" & _ "Address=217.76.131.33,1433;" & _ "Network=DBMSSOCN;" & _ "Database=qj003;" & _ "Uid=qj003;" & _ "Pwd=nicolas;" conex7.Open dns7 EXAMPLES OF MULTIPLE CONNECTIONS FOR DATA sql = "SELECT * FROM Towns Where Active=1 ORDER BY ID ASC" set rdo = conex7.Execute(sql) sql2 = "SELECT * FROM Clientes Where Town = "& rdo("townName") & " AND Active=1" set rdo2 = conex7.Execute(sql2) Now I am using this method EXAMPLE 2 dns = "Driver={SQL Server}; Server=213.171.200.100; Address=213.171.200.100; Database=dbname; Uid=username; Pwd=password; Network=DBMSSOCN;" set Connex = Server.CreateObject("ADODB.Connection") set Rs = Server.CreateObject("ADODB.Recordset") Rs.Source = SELECT * FROM Towns Where Active=1 ORDER BY ID ASC Rs.CursorType = 1 Rs.CursorLocation = 2 Rs.LockType = 3 Connex.open dns I kinda have 2 questions... 1. If I want to open multiple database connections, as I did on the first example, would it just be a case of running another recordset connection like this... and is this or what is the best way to do it? ... And then to extract data, would it be as before, for exampe to extract the name value for a paricular record : name = Rs2("name") ? set Rs2 = Server.CreateObject("ADODB.Recordset") Rs2.Source = SELECT Name, Surname FROM Users Where Active=1 Connex.open dns 2. When do I need to set the following values on a record set... Rs.CursorType = 1 Rs.CursorLocation = 2 Rs.LockType = 3 I am doing paging allow navigation across the records returned, for example requiring, Rs.RecordCount, Rs.PageSize..... do I need to set these in this case?? Any help would be so much appreciated, as I am getting a little lost in all of this S |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Multiple database connections |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|