title: ASP SQL Server Connection
body: <pre class="lang-vb prettyprint-override"><code> &lt;%
   DIM objConn
   Set objConn = Server.CreateObject("ADODB.Connection")
   objConn.ConnectionString = "Data Source=123.123.12.123,1234;Database=DatabaseName;User Id=Usernm;Password=abcd1234;"
   objConn.Open
  
   DIM mySQL
  
   mySQL = "SELECT * FROM [Users] WHERE [User ID]='1'"
  
   DIM objRS
   Set objRS = Server.CreateObject("ADODB.Recordset")
   objRS.open(mySQL, objConn)
  
   Response.Write objRS("FullName")
  
   objRS.Close
   Set objRS = Nothing
   objConn.Close
   Set objConn = Nothing
   %&gt;
  </code></pre>
  
  <p>I want to connect to a SQL Server Database, read the data and close the connection. I have studied the examples and came up with this. But its not working. Please guide me. Where am I going wrong?</p>