Jump to content
Sign in to follow this  

Translating a SQL call from AutoIt to C#

Recommended Posts

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.


$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

Share this post

Link to post
Share on other sites

just a google search gave me this:


Share this post

Link to post
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
Sign in to follow this  

  • Create New...