MySQL UDFs
#321
Posted 08 July 2010 - 09:51 AM
James
#322
Posted 12 August 2010 - 09:54 PM
I am new to SQL and I am trying to connect to the MySQL. I have installed the ODBC-3.51.27 driver but whenever I try to connect to the database it throw a error.
Here is the code
#include <mysql.au3> $sql = _MySQLConnect('sa','1234','mydb', 'MySQL') _CreateTable($sql, 'testtable', 'tt_id') _AddRecord($sql, 'testtable', 'tt_id', 1) $count = _CountRecords($sql, 'testtable', 'tt_id', 1) ;this executes the query "SELECT * FROM `testtable` WHERE `tt_id` = 1 then counts the records _DropTbl($sql,'testtable') _MySQLEnd($sql)
Below is the error I am getting
>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\User\Desktop\SQL\New AutoIt v3 Script (4).au3" C:\Program Files\AutoIt3\Include\mysql.au3 (27) : ==> The requested action with this object has failed.: $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort) $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)^ ERROR >Exit code: 1 Time: 2.516
What am I doing wrong? Thanks for any help!!
#323
Posted 28 August 2010 - 10:45 PM
It's my first post here, so I want to say hello - hello! Sorry in advance for any mistakes, but mainly I don't speak in English (I live in Poland). I have a large MySQL database, currently working for my website. I want to connect this script to my base, but I'm not sure how. When I start my application I would like to see (as a first window) form with logging into the database. The form would consist of two inputs (for login and password) and two buttons (for apply or quit). I've started with GUI and now I stuck with inputs. Here's my code (excluding the GUI):
$login = GUICtrlRead($Input1) $password = GUICtrlRead($Input2) $sql = _MySQLConnect("sa","sa","mydb","mywebsite.com")
Now I need a code to compare the inputs with datas from MySQL database. I was looking for help by myself, but I but haven't found a solution. Can someone help me with it? I would greatly appreciate. Thanks in advance.
Simon from Poland.
#324
Posted 15 October 2010 - 05:39 PM
#include "MySQL.au3" #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Dim $Database = "webdatabase" Dim $MySQLServerName = "192.168.1.1" Dim $TableName = "hardware" $SimonRules = GUICreate("Simon's WebDataBase", 450, 89, 225, 293) $Input1 = GUICtrlCreateInput("", 136, 8, 233, 25) GUICtrlSetColor(-1, 0x000080) $Input2 = GUICtrlCreateInput("", 136, 32, 233, 25) $Login = GUICtrlCreateLabel("Login", 8, 8, 129, 20) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) $Password = GUICtrlCreateLabel("Password", 7, 31, 115, 20) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Apply = GUICtrlCreateButton("Apply", 368, 8, 75, 25, $WS_GROUP) $Exit = GUICtrlCreateButton("Exit", 368, 32, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $Msg = $Apply Apply() Case $Msg = $Exit Exit Case Else ;;; EndSelect WEnd Func Apply() $NameList = "" $SQLQry = "SELECT * FROM hardware" ; Change this to your query $UserName = GUICtrlRead($Input1) $Password = GUICtrlRead($Input2) $SQLInstance = _MySQLConnect($UserName, $Password, $Database, $MySQLServerName) $TableContents = _Query ($SQLInstance, $SQLQry) With $TableContents While Not .EOF $NameList &= .Fields ("ID").value & " " & .Fields ("NAME").value & @CRLF ;Change these "ID" and "NAME" to row names edit as needed .MoveNext WEnd EndWith MsgBox(0,"WebServerData",$NameList) _MySQLEnd ($SQLInstance) EndFunc ;==>Apply
Hi everyone!
It's my first post here, so I want to say hello - hello! Sorry in advance for any mistakes, but mainly I don't speak in English (I live in Poland). I have a large MySQL database, currently working for my website. I want to connect this script to my base, but I'm not sure how. When I start my application I would like to see (as a first window) form with logging into the database. The form would consist of two inputs (for login and password) and two buttons (for apply or quit). I've started with GUI and now I stuck with inputs. Here's my code (excluding the GUI):
$login = GUICtrlRead($Input1) $password = GUICtrlRead($Input2) $sql = _MySQLConnect("sa","sa","mydb","mywebsite.com")
Now I need a code to compare the inputs with datas from MySQL database. I was looking for help by myself, but I but haven't found a solution. Can someone help me with it? I would greatly appreciate. Thanks in advance.
Simon from Poland.
Edited by JamesDover, 15 October 2010 - 05:43 PM.
#325
Posted 08 November 2010 - 02:34 PM
Only Object-type variables allowed in a "With" statement.:
With $var
With ^ ERROR
#include "mysql.au3" $sql = _MySQLConnect("sa","sa","mydb","mywebsite.com") $var = _Query($sql,"SELECT * FROM mytable WHERE user = 'username'") With $var While NOT .EOF FileWriteLine("c:\test.txt",.Fields("user_name").value & @CRLF) .MoveNext WEnd EndWith _MySQLEnd($sql)
Please help, Thanks!
Matt
#326
Posted 18 November 2010 - 09:00 PM
#327
Posted 20 November 2010 - 01:15 AM
Me tooHey there, I'm using Autoit v3.3.6.1, I'm this error:
Only Object-type variables allowed in a "With" statement.:
With $var
With ^ ERROR
#include "mysql.au3" $sql = _MySQLConnect("sa","sa","mydb","mywebsite.com") $var = _Query($sql,"SELECT * FROM mytable WHERE user = 'username'") With $var While NOT .EOF FileWriteLine("c:\test.txt",.Fields("user_name").value & @CRLF) .MoveNext WEnd EndWith _MySQLEnd($sql)
Please help, Thanks!
Matt
#328
Posted 25 December 2010 - 09:29 PM
I have a website, with a DB on it. Now I have tried several things but still can not connect using
_MySQLConnect("sa","sa","mydb","mywebsite.com")
It keeps telling me it doesnt exist or cant connect. How do I get this to work if I cant get it to connect?
#329
Posted 18 January 2011 - 11:06 AM
First enable remote access to your database....and make sure the firewall of the server AND your home is not blocking the 3306 port.I have a silly and noobish question.
I have a website, with a DB on it. Now I have tried several things but still can not connect using_MySQLConnect("sa","sa","mydb","mywebsite.com")
It keeps telling me it doesnt exist or cant connect. How do I get this to work if I cant get it to connect?
#330
Posted 12 February 2011 - 11:53 PM
#331
Posted 24 March 2011 - 02:06 PM
IMHO server should be not 'MySQL' but 'localhost'.
For remote connection we should use plink.exe or any soft that uses plink.exe (for example SQLyogEnt.exe).
For SSH connection port can be 3310.
#332
Posted 01 September 2011 - 03:44 PM
I had a look in my registry and it seems to be indicated as 5.1, not 5.1.8
Also, another gotcha. I want to distribute my work as an AutoIt self-executing exe script. If the computer the script is run on has an older (or newer) ODBC driver what's to be done? The user won't be able to edit the script and may not have the skills to discover what ODBC driver is installed.
#333
Posted 01 September 2011 - 07:54 PM
If you cannot rely on ODBC, you should try to use my UDFs for libmysql or the simplified version EzMySQL.Do you have to have a specific ODBC driver installed? Times have changed and the current version is 5.1.8.
I had a look in my registry and it seems to be indicated as 5.1, not 5.1.8
Also, another gotcha. I want to distribute my work as an AutoIt self-executing exe script. If the computer the script is run on has an older (or newer) ODBC driver what's to be done? The user won't be able to edit the script and may not have the skills to discover what ODBC driver is installed.
#334
Posted 28 September 2011 - 05:19 PM
How to count number records :
mysql_query("SELECT * FROM `abc` WHERE `a` = '123' AND `b` = '456' AND ...... ")
Edited by pocolo, 28 September 2011 - 05:20 PM.
#335
Posted 08 November 2011 - 05:46 PM
#336
Posted 21 December 2011 - 12:53 PM
I'm almost done coding my autoit script. Actually i'm in tests phase.
On the most recent test I decided to see if my script would run properly when MySql server was not running (to account for all possibilities). I would've thought that _MySqlConnect would try to connect and then return an error when it couldn't. But my program crashes with a
$Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort) $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)^ ERROR
What can I do so that my program does not crash and properly catch the error instead?
Thanks for your atention.
#337
Posted 21 December 2011 - 12:59 PM
; COM Error Handler example ; ------------------------- $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Initialize a COM error handler ; ... Your code goes here Exit ; This is my custom defined error handler Func MyErrFunc() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oMyError.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) Endfunc
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#338
Posted 21 December 2011 - 02:15 PM
#339
Posted 21 December 2011 - 02:17 PM
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#340
Posted 28 December 2011 - 04:11 PM
I'am trying this UDF for the first time, it's really cool and simply
Is there something special to know about accent marks like é è ù ö ?
I try to insert through Autoit some records with frenchs words but it failed... If I try to insert "vélo" it just insert "v"
Is there something to do in autoit code, or it is in the MySQL base there is somenthing wrong. It is in UTF-8 Unicode (utf8)
Thanks you
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users




