I recently found a host that offers SQL Server as part of their hosting deal, but they state that you can only access it via ASP scripts, and not by using ODBC, OLEDB etc. Does ASP have its own connective technology?
I have used ASP but I have always used either ODBC or OLEDB for backend connection, so their response seems a bit odd to me. So, does anyone know how it is possible to access a backend DBMS using ASP scripts exclusively?
HI,
May be what they want to say that you can not connect the DB using DSN(User,file or system). you have to connect the DB using DSN less connection and using native interfaces in ASP. Here is a sample code. Try this out:
--------------------------------------
<% ' to integrate/test this code replace the
' Data Source value in the Connection string%>
<%
' connection and recordset variables
Dim Cnxn, strCnxn
Dim rsCustomers, strSQLCustomers
Dim rsProducts, strSQLProducts
' create and open first Recordset using Connection - execute
Set rsCustomers = Server.CreateObject("ADODB.Recordset")
strSQLCustomers = "SELECT CompanyName, ContactName, City FROM Customers"
Set rsCustomers = Cnxn.Execute(strSQLCustomers)
' create and open second Recordset using recordset - open
Set rsProducts = Server.CreateObject("ADODB.Recordset")
strSQLProducts = "SELECT ProductName, UnitPrice FROM Products"
rsProducts.Open strSQLProducts, Cnxn, adOpenDynamic, adLockPessimistic, adCmdText
%>
----------------------------
Bookmarks