Sub ConnectToSQLServer() On Error GoTo EH 'Assuming the SQL Express database is configured for remote connections you can. You generally do this by opening a connection to the database and then issuing your query: 'Ref Microsoft AxtiveX Data Objects 6.0 Library Dim con As ADODB.Connection Set con = New ADODB.Connection con.Open "Provider=SQLOLEDB;Data Source=184.108.40.206,1444;Network Library=DBMSSOCN;Initial Catalog=sqlserver1;User ID=murbro;Password=chestnut;" 'sql7.[yourdomain.com],1444 (220.127.116.11) (Web Manager) (Port 1444) '/ Note that connection string from here: http://www.connectionstrings.com/sql-server-2008#p2 Dim rst As ADODB.Recordset Set rst = New ADODB.Recordset rst.Open "SELECT * FROM MyTable", con 'These are the basics, but this would leave you with a fully filled Recordset. 'Note that unless your online host has assigned a name for this, you'd have to use the full IP address as "Server" portion Exit Sub EH: MsgBox Err.Description End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.