Dim con As ADODB.Connection Dim rst As ADODB.Recordset Dim cmd As ADODB.Command 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 Set con = New ADODB.Connection con.Open "Provider=SQLOLEDB;Data Source=18.104.22.168,1444;Network Library=DBMSSOCN;Initial Catalog=sqlserver1;User ID=mubro;Password=chet;" 'sql7.[yourdomain.com],1444 (22.214.171.124) (Web Manager) (Port 1444) '/ Note that connection string from here: http://www.connectionstrings.com/sql-server-2008#p2 ' murbro: Connection Information: sql7.[yourdomain.com],1444 (126.96.36.199) (Web Manager) (Port 1444) Set rst = New ADODB.Recordset rst.Open "SELECT * FROM Table1", 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 Do While Not rst.EOF MsgBox rst.Fields("Col1").Value rst.MoveNext Loop rst.Close Set rst = Nothing Set con = Nothing 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.