With or Without DSN


#1

When I try to use a DSN Name, it doesn't work. For example:

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "DSN=Northwind"

Set RS = CreateObject("ADODB.Recordset")

RS.Open "SELECT * FROM AsposeWordOrderDetails WHERE OrderId = 10444 ORDER BY ProductID", Conn

Doc.MailMerge.ExecuteWithRegionsADO RS, "OrderDetails"

If I use a DSN-less connection, it works:
RS.Open "SELECT * FROM AsposeWordOrderDetails WHERE OrderId = 10444 ORDER BY ProductID", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\Aspose.Word\Demos\Database\Northwind.mdb"

Any reason why?


#2

It’s hard to tell since I’ve not been using ADO extensively. But my guess there are System wide and User DSNs and you probably need to make sure you use a System DSN since you probably execute the script in IIS and that’s a different user account and does not see your User DSNs.