Jump to content

Translating a SQL call from AutoIt to C#


 Share

Recommended Posts

  • Moderators

This is just a curiosity question; I've been playing with C# a little bit, with VS 2010 Express. I've taken a front-end I wrote in AutoIt, and am working through converting functions just to see what the translation looks like. One thing I have run into hurdles with is making a connection to and sending calls to a SQL database. I've been googling a bit, just thought I would ask here as well as I know many forum members work in other languages. Below is a snipped of the function in AutoIt, if anyone can nudge me in the right direction I would appreciate it.

Connection

$oLocator = ObjCreate("WbemScripting.SWbemLocator")
$oSMS = $oLocator.ConnectServer($sServer, "root\sms\site_" & $SCode)
   If @error Then Exit MsgBox(0, "Sparrow SCCM Console", "Can't Connect")
$oSMS.Security_.ImpersonationLevel = 3
$oSMS.Security_.AuthenticationLevel = 6

Sample Call

$oResults = $oSMS.ExecQuery("SELECT * FROM SMS_Collection WHERE Comment LIKE '%License%' ORDER by Name")
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...