remote MS SQL databse connection

Furr

Can't get enough of FH
Joined
Dec 22, 2003
Messages
1,067
Ok I know im posting lots of questions, but in someways it means we are building up a nice forum full of questions and answers :p

Ok my latest problem. How do i connect remotely to a MS SQL databse, I have MS SQL server 2005 which came with Visual express. And have an IP address, a database name, username and password.

I've been given a connection string fille that looks like this, (yes is has italian remarks...)

PHP:
<% '// Connection string 
Dim ConnectionString
Dim DBServer, DBUser, DBPass, DBTable, strFile

DBServer	= "62.xxx.xxx.xx"
DBTable		= "MSxxxxxxx"
DBUser		= "MSxxxxxxx"
DBPass	 	= "7xxxxxxx7"

'// Imposto la stringa di connessione

' _____ MY SQL _____
'ConnectionString = 	"DRIVER={MySQL ODBC 3.51 Driver};" &_
'					"SERVER=" & DBServer & ";" &_
'					"DATABASE=" & DBTable & ";" &_
'					"USER=" & DBUser & ";" &_
'					"PASSWORD=" & DBPass & ";OPTION=3;"

' ____ SQL SERVER ____
ConnectionString = 	"PROVIDER=SQLOLEDB;" &_
					"Driver={SQL Server};"	&_
					"Server="	& DBServer	& ";" &_
					"Database="	& DBTable	& ";" &_
					"Uid="		& DBUser 	& ";" &_
					"Pwd="		& DBPass 	& ";"
					
' ____ ACCESS ____
'	strFile = Server.MapPath("/mdb-database/mydb.mdb")'request.ServerVariables("APPL_PHYSICAL_PATH") & "/mdb-database/mydb.mdb"
		
'	ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile & ";"
					
'// Imposto il debug
If Session("Debug") then
	response.Write("ConnectionString: " & ConnectionString & "<br>" & vbcrlf)
	response.Flush()
End If

%>

Using dreameaver optimally for this as i like the instant visual layout mode and its CSS system is works well.

So help please... (again)
 

Panda On Smack

Can't get enough of FH
Joined
Dec 22, 2003
Messages
1,030
I make a file called connect and include it in the pages needing DB connections:

Dim DSN
DSN = "Provider=SQLOLEDB;Server=<IP>;User ID=<username>;Password=<password>;Database=<database name>;"
 

Users who are viewing this thread

Top Bottom