Jump to content
Sign in to follow this  
faustf

problem with DB mysql

Recommended Posts

faustf

hi guy i do a big script in a part of this script , i have created this

Func _tag_sitlefacebook()
$tag_scritta=GUICtrlRead($input2)
if $tag_scritta = '' Then
MsgBox(4160+48,"info","Inserisci la scritta nel tag ")
Else
MsgBox(4160+48,"info","Premi il tasto destro sulla  foto ")

While 1
if _IsPressed(02) Then
$pos = MouseGetPos()

  $ax=($pos[0]-50)
  $ay=($pos[1]-110)
  $a = GUICtrlCreateGraphic($ax, $ay, 4, 80)
       GuiCtrlSetState(-1,$GUI_ONTOP)
    GUICtrlSetBkColor(-1, 0xff00)
  $cx=($pos[0]-50)
  $cy=($pos[1]-110)
  $c = GUICtrlCreateGraphic($cx, $cy, 80, 4)
    GuiCtrlSetState(-1,$GUI_ONTOP)
    GUICtrlSetBkColor(-1, 0xff00)
  $dx=($pos[0]+27)
  $dy=($pos[1]-110)
  $d = GUICtrlCreateGraphic($dx, $dy, 4, 80)
       GuiCtrlSetState(-1,$GUI_ONTOP)
    GUICtrlSetBkColor(-1, 0xff00)
  $bx=($pos[0]-50)
  $by= ($pos[1]-30)
  $b = GUICtrlCreateGraphic($bx,$by, 81, 20)
    GuiCtrlSetState(-1,$GUI_ONTOP)
    GUICtrlSetBkColor(-1, 0xff00)
  $label2X=($pos[0]-50)
  $label2Y=($pos[1]-30)
  $Label2 = GUICtrlCreateLabel($tag_scritta,$label2X ,$label2Y , 81, 20)
  GUICtrlSetBkColor(-1, 0x00FF00)

exitloop
EndIf
WEnd
  Dim $TableName = "tagps"
  Dim $ColumnNames[2]
  Dim $NewGuest[2]
  $ColumnNames[0] = "Tag_Bx"
  $ColumnNames[1] = ""
MsgBox(0,'',$bx)
  $NewGuest[0] = $bx
  $NewGuest[1] = ""
  $SQLInstance = _MySQLConnect($UserName, $Password, $Database, $MySQLServerName)
  _AddRecord($SQLInstance, $TableName, $ColumnNames, $NewGuest)
  _MySQLEnd($SQLInstance)
EndIf

   EndFunc

if use $bx . script crashed

if use 'try this'

the script go correctly

this is mistake:

>Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\stefano\Documents\programmazione\gestionale\GEST - ottimizzato.au3"

C:\Users\stefano\Documents\programmazione\gestionale\MySQL.au3 (132) : ==> The requested action with this object has failed.:

$oconnectionobj.execute ($query)

$oconnectionobj.execute ($query)^ ERROR

->17:04:55 AutoIT3.exe ended.rc:1

my table in mysql is this

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------

-- Table structure for `tagps`

-- ----------------------------

DROP TABLE IF EXISTS `tagps`;

CREATE TABLE `tagps` (

`Tag_ID` int(11) NOT NULL AUTO_INCREMENT,

`Tag_Ax` varchar(300) DEFAULT NULL,

`Tag_Ay` varchar(300) DEFAULT NULL,

`Tag_Bx` varchar(300) DEFAULT NULL,

`Tag_By` varchar(300) DEFAULT NULL,

`Tag_Cx` varchar(300) DEFAULT NULL,

`Tag_Cy` varchar(300) DEFAULT NULL,

`Tag_Dx` varchar(300) DEFAULT NULL,

`Tag_Dy` varchar(300) DEFAULT NULL,

`Tag_label2X` varchar(300) DEFAULT NULL,

`Tag_label2Y` varchar(300) DEFAULT NULL,

`Tag_Descrizione` varchar(300) DEFAULT NULL,

`Tag_quantita` varchar(300) DEFAULT NULL,

`Tag_codice` varchar(300) DEFAULT NULL,

PRIMARY KEY (`Tag_ID`)

) ENGINE=InnoDB AUTO_INCREMENT=403 DEFAULT CHARSET=utf8;

-- ----------------------------

-- Records of tagps

-- ----------------------------

INSERT INTO `tagps` VALUES ('1', null, null, null, null, null, null, null, null, null, null, null, null, null);

Share this post


Link to post
Share on other sites
faustf

yea yea odbc is ok but if i replace this variable

$bx

with 'test' or '300'

the program go perfectly insert in db and do all good

Share this post


Link to post
Share on other sites
bogQ

sry for delite realized what you have problem with but 2 late :P

did you try to use string($bx) ?

and read comment in udf for arrayes if needed on _AddRecord func

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
faustf

string?? how???

i use get mouse pos and grab position and put the (part) of position in variable

$bx=($pos[0]-50)

how can use string?

Share this post


Link to post
Share on other sites
jchd

You're trying to insert an integr in a string-typed column (varchar). Use String() as bogQ said:

$bx = String($pos[0]-50)


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
faustf

o yea you are genius :) thankzz so much

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  

×