Warmonger Posted April 15, 2011 Posted April 15, 2011 (edited) How would it be done? Example Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon.Execute($Query) TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc Edited April 16, 2011 by Warmonger [AutoIt File Patcher]
PsaltyDS Posted April 15, 2011 Posted April 15, 2011 Please don't do that. When you solve a problem, leave the problem and the solution in the forum for others as a future reference through the search function. It reduces the value of the site over time if the problems/solutions get deleted. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Warmonger Posted April 16, 2011 Author Posted April 16, 2011 (edited) Please don't do that. When you solve a problem, leave the problem and the solution in the forum for others as a future reference through the search function. It reduces the value of the site over time if the problems/solutions get deleted.I would of but the problem wasnt solved. And the function wasnt something I wanted to post. I will remake original topic. Since this issue I cannot solve with a quick example function. Edited April 16, 2011 by Warmonger [AutoIt File Patcher]
Zedna Posted April 16, 2011 Posted April 16, 2011 Here are two possible way how to do it: Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $sqlCon2 = ObjCreate('ADODB.Connection') $sqlCon2.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query2 = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon2.Execute($Query2) TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $sqlCon.Close $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon.Execute($Query) $sqlCon.Close $sqlCon = 0 TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc And here is another way in case you use the same user/password for both SQL queries Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $Query = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon.Execute($Query) $sqlCon.Close $sqlCon = 0 TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search
Warmonger Posted May 9, 2011 Author Posted May 9, 2011 (edited) Here are two possible way how to do it: Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $sqlCon2 = ObjCreate('ADODB.Connection') $sqlCon2.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query2 = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon2.Execute($Query2) TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $sqlCon.Close $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon.Execute($Query) $sqlCon.Close $sqlCon = 0 TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc And here is another way in case you use the same user/password for both SQL queries Func _Ban() $sqlCon = ObjCreate('ADODB.Connection') $sqlCon.Open('DRIVER={SQL Server};SERVER=' & $Server & ';DATABASE=Character;UID=' & $User & ';PWD=' & $Pass & ';') $Query = 'Select Bla Bla From Bla where bla=bla' $Result = $sqlCon.Execute($Query) $Query = 'Select Bla Bla From Bla Where bla=' & $Result.GetString $sqlCon.Execute($Query) $sqlCon.Close $sqlCon = 0 TCPSend($sSocket[$x], 'Player ' & $sFilter[2] & ' Has Been Banned!') EndFunc Still doesn't work any of them above. You have to store the $Result.GetString into a new variable to keep its value during the next sql connection. But for some reason it doesn't update the sql result like its suppose to (its not my querys). Even when I pass off the result to another function. It still doesn't update the result. This is weird... Edited May 10, 2011 by Warmonger [AutoIt File Patcher]
Warmonger Posted May 10, 2011 Author Posted May 10, 2011 (edited) Solved! The query results had to be stored into a new variable else it wont hold its value, then you must trim it.The ProblemSelect user_no From [USER_CHARACTER] Where character_name = 'Warmonger ' <-- Trailing Apostrophe On New LineThe Fix$User_No = StringTrimRight($Result.GetString, 1) Edited May 10, 2011 by Warmonger [AutoIt File Patcher]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now