navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

FrontPage Convert From ODBC

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> FrontPage Convert From ODBC
Page: [1]
 
Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
FrontPage Convert From ODBC - 7/22/2005 12:18:20   
You are best to use an OLEDB connection when accessing databases via FP
However - the default is an ODBC connection.

Some versions of the global.asa file include a conversion, but some dont.
Here is the code that you can include in the global.asa file.

To action the sub, there should be a call in the OnStart sub like so :

Sub Session_OnStart
FrontPage_ConvertFromODBC
End Sub


Sub FrontPage_ConvertFromODBC
	On Error Resume Next
	if Len(Application("ASP_OS")) > 0 then exit sub
	str = "_ConnectionString"
	slen = Len(str)
	set oKnown = Server.CreateObject("Scripting.Dictionary")
	oKnown.Add "DRIVER",""
	oKnown.Add "DBQ",""
	oKnown.Add "SERVER",""
	oKnown.Add "DATABASE",""
	oKnown.Add "UID",""
	oKnown.Add "PWD",""
	Application.Lock
	For each item in Application.Contents
		if UCase(Right(item,slen)) = UCase(str) then
			sName = Left(item,Len(item)-slen)
			sConn = Application(item)
			if InStr(LCase(sConn),"provider=") < 1 and Len(Application(sName & "_ConnectionTimeout"))>0 then
				sArr = Split(sConn,";")
				set oDict = Server.CreateObject("Scripting.Dictionary")
				bUnknown = False
				for i = 0 to UBound(sArr)
					s = sArr(i)
					idx = InStr(s,"=")
					sKey = UCase(Trim(Left(s,idx-1)))
					sVal = Trim(Mid(s,idx+1))
					oDict.Add sKey, sVal
					if Not oKnown.Exists(sKey) then bUnknown = True
				next
				if bUnknown = False and oDict.Exists("DRIVER") then
					sDrv = oDict.Item("DRIVER")
					sNew = ""
					if InStr(sDrv,"Microsoft Access") > 0 and oDict.Exists("DBQ") and not (oDict.Exists("UID") or oDict.Exists("PWD")) then
						sNew = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & oDict.Item("DBQ")
					elseif InStr(sDrv,"SQL Server") > 0 and oDict.Exists("SERVER") and oDict.Exists("DATABASE") then
						sNew = "Provider=SQLOLEDB;Data Source=" & oDict("SERVER") & ";Initial Catalog=" & oDict("DATABASE")
						if oDict.Exists("UID") then sNew = sNew & ";User ID=" & oDict("UID")
						if oDict.Exists("PWD") then sNew = sNew & ";Password=" & oDict("PWD")
					end if
					if sNew <> "" then
						Application(item) = sNew
					end if
				end if
				set oDict = Nothing
			end if
		end if
	Next
	Application.Unlock
	Set oKnown = Nothing
End Sub


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)

maltina1

 

Posts: 62
Joined: 4/25/2006
Status: offline

 
RE: FrontPage Convert From ODBC - 8/2/2006 5:28:32   

quote:

ORIGINAL: Spooky

You are best to use an OLEDB connection when accessing databases via FP
However - the default is an ODBC connection.

Some versions of the global.asa file include a conversion, but some dont.


I have taken your advise.I checked if my global include the conversion.And it does.The code is exactly as you have quoted above.I have used DIW for the creation of the forms.But on the other machines it works,except on this server.

Thanks for your response

(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> FrontPage Convert From ODBC
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts