%
IF Request.Form("Continue") = "Continue" Then
Set SQLConnect = Server.CreateObject("ADODB.Connection")
SQLConnect.Open "Driver={SQL Server};Server=208.18.48.246;Database=houseviewonline;Uid=houseviewonline;Pwd=supernova04;"
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=f:\webroot\houseview-online.com\IDX\IDX.mdb;"
'End Delete/Re-populate SQL Server Listings--------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Un-comment to empty database prior to re-populate
SQLConnect.Execute("DELETE IDXListings")
Response.Write("
Listings Deleted Successfully From SQL Server
")
sqlnew="SELECT * FROM Listings ORDER BY MLS ASC"
Set RS = Connect.execute(sqlnew)
If Not RS.BOF Then
RS.MoveFirst
Do Until RS.EOF
sqlnew="insert into IDXListings(MLS,PRICE,CITY,STATE,ZIP,GROUPING,AGENT,AGENTPHONE,OFFICE,OFFICEPHONE,NOTES,BED,BATHFULL,BATHHALF,FEATURES,TYPE1,TYPE2,BASEMENT,SQFT,AGE,TYPE3,MASTERLEVEL,AUX1,AUX2,AUX3,AUX4,AUX5,AUX6,STREETNUM,STREETDIRECTION,STREETNAME,CATEGORY) values ("&RS.Fields("MLS")&","&RS.Fields("PRICE")&",'"&Replace(RS.Fields("CITY"),"'","''")&"','"&RS.Fields("STATE")&"','"&RS.Fields("ZIP")&"',"&RS.Fields("GROUPING")&",'"&RS.Fields("AGENT")&"','"&RS.Fields("AGENTPHONE")&"','"&RS.Fields("OFFICE")&"','"&RS.Fields("OFFICEPHONE")&"','"&Replace(RS.Fields("NOTES"),"'","''")&"','"&RS.Fields("BED")&"','"&RS.Fields("BATHFULL")&"','"&RS.Fields("BATHHALF")&"','"&Replace(RS.Fields("FEATURES"),"'","''")&"','"&RS.Fields("TYPE1")&"','"&RS.Fields("TYPE2")&"','"&RS.Fields("BASEMENT")&"','"&RS.Fields("SQFT")&"','"&RS.Fields("AGE")&"','"&RS.Fields("TYPE3")&"','"&RS.Fields("MASTERLEVEL")&"','"&Replace(RS.Fields("AUX1"),"'","''")&"','"&Replace(RS.Fields("AUX2"),"'","''")&"','"&Replace(RS.Fields("AUX3"),"'","''")&"','"&Replace(RS.Fields("AUX4"),"'","''")&"','"&Replace(RS.Fields("AUX5"),"'","''")&"','"&Replace(RS.Fields("AUX6"),"'","''")&"','"&Replace(RS.Fields("STREETNUM"),"'","''")&"','"&Replace(RS.Fields("STREETDIRECTION"),"'","''")&"','"&Replace(RS.Fields("STREETNAME"),"'","''")&"','"&RS.Fields("CATEGORY")&"')"
SQLConnect.execute(sqlnew)
RS.MoveNext
Loop
End if
RS.Close
Set RS = Nothing
sqlnew=""
Response.Write("Listings Successfully Re-Synced From Access to SQL Server
")
'End Delete/Re-populate SQL Server Listings--------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'End Delete/Re-populate SQL Server Features--------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Un-comment to empty database prior to re-populate
SQLConnect.Execute("DELETE IDXFeatures")
Response.Write("
Features Deleted Successfully From SQL Server
")
sqlnew="SELECT * FROM Features ORDER BY FeatureID ASC"
Set RS = Connect.execute(sqlnew)
If Not RS.BOF Then
RS.MoveFirst
Do Until RS.EOF
sqlnew="insert into IDXFeatures(FeatureID,CatID,Code,Abbrev,Description) values ("&RS.Fields("FeatureID")&","&RS.Fields("CatID")&","&RS.Fields("Code")&",'"&Replace(RS.Fields("Abbrev"),"'","''")&"','"&Replace(RS.Fields("Description"),"'","''")&"')"
SQLConnect.execute(sqlnew)
RS.MoveNext
Loop
End if
RS.Close
Set RS = Nothing
sqlnew=""
Response.Write("Features Successfully Re-Synced From Access to SQL Server
")
'End Delete/Re-populate SQL Server Features--------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'End Delete/Re-populate SQL Server Feature Categories----------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Un-comment to empty database prior to re-populate
SQLConnect.Execute("DELETE IDXFeatureCategories")
Response.Write("
Feature Categories Deleted Successfully From SQL Server
")
sqlnew="SELECT * FROM FeatureCategories ORDER BY CatID ASC"
Set RS = Connect.execute(sqlnew)
If Not RS.BOF Then
RS.MoveFirst
Do Until RS.EOF
sqlnew="insert into IDXFeatureCategories(CatID,ClassID,Code,Description) values ("&RS.Fields("CatID")&","&RS.Fields("ClassID")&",'"&Replace(RS.Fields("Code"),"'","''")&"','"&Replace(RS.Fields("Description"),"'","''")&"')"
SQLConnect.execute(sqlnew)
RS.MoveNext
Loop
End if
RS.Close
Set RS = Nothing
sqlnew=""
Response.Write("Feature Categories Successfully Re-Synced From Access to SQL Server
")
'End Delete/Re-populate SQL Server Feature Categories----------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'End Delete/Re-populate SQL Server Agency---------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Un-comment to empty database prior to re-populate
SQLConnect.Execute("DELETE IDXAgency")
Response.Write("
Agency Deleted Successfully From SQL Server
")
sqlnew="SELECT * FROM Agency ORDER BY ID ASC"
Set RS = Connect.execute(sqlnew)
If Not RS.BOF Then
RS.MoveFirst
Do Until RS.EOF
sqlnew="insert into IDXAgency(agency,grouping,address,city,state,zip,phone,fax,email,other,logo,extra1,extra2,extra3,extra4,extra5) values ('"&RS.Fields("agency")&"',"&RS.Fields("grouping")&",'"&RS.Fields("address")&"','"&RS.Fields("city")&"','"&RS.Fields("state")&"',"&RS.Fields("zip")&",'"&RS.Fields("phone")&"','"&RS.Fields("fax")&"','"&RS.Fields("email")&"','"&RS.Fields("other")&"','"&RS.Fields("logo")&"','"&RS.Fields("extra1")&"','"&RS.Fields("extra2")&"','"&RS.Fields("extra3")&"','"&RS.Fields("extra4")&"','"&RS.Fields("extra5")&"')"
SQLConnect.execute(sqlnew)
RS.MoveNext
Loop
End if
RS.Close
Set RS = Nothing
sqlnew=""
Response.Write("Agency Successfully Re-Synced From Access to SQL Server
")
'End Delete/Re-populate SQL Server Agency----------------------------------------------------------
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Response.Write("
HouseViewOnline.com Access/SQL Server IDX Sync Completed on " & now() & "
")
Connect.Close
Set Connect = Nothing
SQLConnect.Close
Set SQLConnect = Nothing
End if
%>
|
This will Syncronize the HouseViewOnline.com Accesss Database to The SQL Server |