sql sqlsever/outlook

  • Hi!!! Could someone tell me if is posiible to join a sql server database to an outlook application (built by using VBA).

    I need to query a sql db from outlook.

    Thanks

    regards

  • Check sp_processmail and xp_readmail from BOL.

  • Sure, just add a reference to ADO ("Microsoft ActiveX Data Object 2.x Library") and you're set. If you don't know ADO, then you'll need to learn it, though.

    --Jonathan



    --Jonathan

  • Try the following:

    
    
    Dim cmd as ADODB.Command
    Dim rs as ADODB.Recordset

    Set cmd = New ADODB.Command
    With cmd
    .ActiveConnection = "Driver={SQL Server};Server=Svr1;Database=db1;Trusted_Connection=Yes"
    .CommandType = adCmdStoredProc
    .CommandText = "uspMySP"
    .Parameters.Append .CreateParameter("@param1", adVarChar, adParamInput, 50, myVal)
    Set rs = .Execute

    That should give you a recordset returned by uspMySP taking a parameter of myVal.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply