Monday

vba code : access sql server from outlook



'Access SQL server from oputlook
Sub AccessSQLServer(Item As Outlook.MailItem)
Set con = CreateObject("ADODB.Connection")
con.Open "driver={SQL Server};Uid=sa;server=myserv;pwd=mypass;database=mydb;"
Set rs = CreateObject("ADODB.Recordset")
rs.ActiveConnection = con
rs.Open "SELECT * FROM MyTable"
Do While Not rs.EOF
MsgBox rs("id")
rs.MoveNext
Loop
End Sub


more...

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...