require 'dbi'

module Databases

  class SQLServerConnection
                
                def initialize(server_name, db, user_name=nil, password=nil)
                        @db = db
                
                        if user_name.nil? or password.nil?
                                @dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
Source=#{server_name};Intitial catalog...@db};Integrated
Security=SSPI")
                        else
                                @dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
Source=#{server_name};Intitial catalog...@db};Integrated
Security=SSPI;User Id=#{user_name};Password=#{password}")
                        end
                                
                end

    def execute_sql(sql)
      @dbh.execute("USE #...@db}")
      sth = @dbh.prepare(sql)
      sth.execute
      row=sth.fetch
    end
  end

end

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to