Monday

read data from SQL sevrer with Ruby/WIN32OLE way



def read_sp(sp_text,sr,db,pwd)
conn = WIN32OLE.new('ADODB.Connection')
conn.Open("driver={SQL Server};Uid=sa;server=#{sr};pwd=#{pwd};database=#{db};")
rset = WIN32OLE.new('ADODB.Recordset')
rset.ActiveConnection = conn
rset.Open(sp_text)
s = ""
while not rset.EOF do
for i in (0..rset.Fields.Count - 1) do
s += rset.Fields.Item(i).Value.to_s.strip
end
rset.MoveNext
end
return s;

end



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 ...