Link to home
Start Free TrialLog in
Avatar of niico
niico

asked on

Client side VBScript passing parameters to a SQL Server DSN

I have a web page that fires client side VBScript. This script initiates a mail merge with a local word document on a locally setup DSN.

I can get the following [extract] to work without parameters:
wrdDoc.MailMerge.OpenDataSource "", , , , , , , , , , , "DSN=MyDSN", "sp_MySproc", , , wdMergeSubTypeWord2000
wrdDoc.MailMerge.Destination = wdSendToNewDocument
wrdDoc.MailMerge.Execute False


Is it possible to pass parameters into the sproc that Im executing?

Thanks..
ASKER CERTIFIED SOLUTION
Avatar of ambientnet
ambientnet

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of niico
niico

ASKER

Great

Thanks twice for the added sp_ advice - didnt realise that!

I'll check it out and get back to you...
Avatar of niico

ASKER

Is there any way to define the datatype of each parameter? does it matter in any case?
niico,
     That's an interesting question. Does it matter? That depends on what you're trying to pass. If you're trying to pass strings (char's, varchars, nvarchars etc), then I wouldn't worry about it. If you're trying to pass an Int, I wouldn't worry about it. But you can always open a recordset by way of ADODB.Command and assign Parameters and their Types using the cmdVariable.CreateParameter Method.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdamth01_14.asp   has more information.

But that's a different code structure than what you're trying to do, from what I can see. In that instance, you'd open the "DSN"/Recordset and have your MailMerge Code inside of a Loop.

I'm not sure if you need to go further than 'exec'.. I'd try using your current code and seeing if you run into any problems. My thought is that you won't. ;)
Let me know when things work out!

-m

Avatar of niico

ASKER

This works well - thanks very much!