Jump to content

gstsfb123

Üye
  • Posts

    16
  • Joined

  • Last visited

Posts posted by gstsfb123

  1. Beyler k.bakmayın autoit ile alakalı çok fazla bir bilgim yok koda form desinger programı ile yaptığım tasarım a mysql alanımdan veri çekip düzenleyip geri kaydetmek için bir çalışma yaptım fakat komut kodlarından hiç anlamıyorum bu anlatmaya çalıştığım şey mysql alanımda şöyle yer almakta

    DB min yolu

    Player sekmesinin içinde item_proto dosyası

    Player>item_proto

    ben bu
    item protonun içinden vnum bölmesinden kod aratıcam üstteki ara butonu onun içinden arıyor

    [img]http://www.tnctr.com/uploads/imgs/pre_1310892777__adsz.png[/img]

    DB'deki tablonun resmi burdan msla 11299 u arattım ordan program kendi içinden bulsun soldaki type subtype fln gibi yerleri yerlerine göre sıralasın formdaki yaptığım gibi sırası değişik olması gerekiyorda

    [img]http://www.tnctr.com/uploads/imgs/pre_1310893194__adsz.png[/img]

    birde alt tarafa yeni diye buton koymuştum oda arama yapmadan alanları doldurduğumda yeni bir satır oluşturabilirmiyiz

    yardımlarınız için çok teşekkürler harika bir forum formun kodları

    [code]
    [PROGRAMIN KENDİSİ Program.au3]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <mysql.au3>

    GUISetState(@SW_SHOW)
    $Form1_1 = GUICreate("X-Virus İtem Proto Editor", 1018, 456, 155, 112, -1)
    $Group1 = GUICtrlCreateGroup("Bilgiler", 8, 64, 1001, 385, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))

    $Label2 = GUICtrlCreateLabel("Vnum :", 16, 88, 37, 17)
    $vnum = GUICtrlCreateInput("", 64, 86, 105, 21)

    $Label3 = GUICtrlCreateLabel("Locale_Name :", 184, 88, 76, 17)
    $local_name = GUICtrlCreateInput("", 256, 86, 105, 21)

    $Label4 = GUICtrlCreateLabel("Type :", 368, 88, 34, 17)
    $type = GUICtrlCreateInput("", 408, 86, 105, 21)

    $Label5 = GUICtrlCreateLabel("Subtype :", 520, 88, 49, 17)
    $subtype = GUICtrlCreateInput("", 576, 86, 105, 21)

    $Label6 = GUICtrlCreateLabel("Weight :", 688, 88, 44, 17)
    $weight = GUICtrlCreateInput("", 736, 86, 105, 21)

    $Label7 = GUICtrlCreateLabel("Size :", 848, 88, 30, 17)
    $size = GUICtrlCreateInput("", 896, 86, 105, 21)

    $Label8 = GUICtrlCreateLabel("Antiflag :", 16, 128, 45, 17)
    $antiflag = GUICtrlCreateInput("", 64, 126, 105, 21)

    $Label9 = GUICtrlCreateLabel("Flag :", 184, 128, 30, 17)
    $flag = GUICtrlCreateInput("", 256, 126, 105, 21)

    $Label10 = GUICtrlCreateLabel("W.Flag :", 368, 128, 44, 17)
    $wearflag = GUICtrlCreateInput("", 408, 126, 105, 21)

    $Label11 = GUICtrlCreateLabel("İm.Flag :", 520, 128, 44, 17)
    $immuneflag = GUICtrlCreateInput("", 576, 126, 105, 21)

    $Label12 = GUICtrlCreateLabel("Gold :", 688, 128, 32, 17)
    $gold = GUICtrlCreateInput("", 736, 126, 105, 21)

    $Label13 = GUICtrlCreateLabel("B.Price :", 848, 128, 44, 17)
    $shop_buy_price = GUICtrlCreateInput("", 896, 126, 105, 21)

    $Label14 = GUICtrlCreateLabel("Limittype0 :", 16, 168, 57, 17)
    $limittype0 = GUICtrlCreateInput("", 80, 166, 105, 21)

    $Label15 = GUICtrlCreateLabel("Limitvalue0 :", 192, 168, 63, 17)
    $limitvalue0 = GUICtrlCreateInput("", 272, 166, 105, 21)

    $Label16 = GUICtrlCreateLabel("Limittype1 :", 384, 168, 57, 17)
    $limittype1 = GUICtrlCreateInput("", 456, 166, 105, 21)

    $Label17 = GUICtrlCreateLabel("LimittypeV.1 :", 568, 168, 67, 17)
    $limitvalue1 = GUICtrlCreateInput("", 632, 166, 105, 21)

    $Label18 = GUICtrlCreateLabel("Applytype0 :", 744, 168, 62, 17)
    $applytype0 = GUICtrlCreateInput("", 816, 166, 105, 21)

    $Label19 = GUICtrlCreateLabel("ApplyV.0 :", 16, 208, 52, 17)
    $applyvalue0 = GUICtrlCreateInput("", 80, 206, 105, 21)

    $Label20 = GUICtrlCreateLabel("Applytype1 :", 192, 208, 62, 17)
    $applytype1 = GUICtrlCreateInput("", 272, 206, 105, 21)

    $Label21 = GUICtrlCreateLabel("ApplyV.1 :", 384, 208, 52, 17)
    $applyvalue1 = GUICtrlCreateInput("", 456, 206, 105, 21)

    $Label22 = GUICtrlCreateLabel("Applytype2 :", 568, 208, 62, 17)
    $applytype2 = GUICtrlCreateInput("", 632, 206, 105, 21)

    $Label23 = GUICtrlCreateLabel("Apply.V.2 :", 744, 208, 55, 17)
    $applyvalue2 = GUICtrlCreateInput("", 816, 206, 105, 21)

    $Label24 = GUICtrlCreateLabel("Value0 :", 16, 248, 43, 17)
    $value0 = GUICtrlCreateInput("", 80, 246, 105, 21)

    $Label25 = GUICtrlCreateLabel("Value1 :", 192, 248, 43, 17)
    $value1 = GUICtrlCreateInput("", 272, 246, 105, 21)

    $Label26 = GUICtrlCreateLabel("Value2 :", 384, 248, 43, 17)
    $value2 = GUICtrlCreateInput("", 456, 246, 105, 21)

    $Label27 = GUICtrlCreateLabel("Value3 :", 568, 248, 43, 17)
    $value3 = GUICtrlCreateInput("", 632, 246, 105, 21)

    $Label28 = GUICtrlCreateLabel("Value4 :", 752, 248, 43, 17)
    $value4 = GUICtrlCreateInput("", 816, 246, 105, 21)

    $Label29 = GUICtrlCreateLabel("Value5 :", 16, 288, 43, 17)
    $value5 = GUICtrlCreateInput("", 80, 286, 105, 21)

    $Label30 = GUICtrlCreateLabel("Socket0 :", 192, 288, 50, 17)
    $socket0 = GUICtrlCreateInput("", 272, 286, 105, 21)

    $Label31 = GUICtrlCreateLabel("Socket1 :", 384, 288, 50, 17)
    $socket1 = GUICtrlCreateInput("", 456, 286, 105, 21)

    $Label32 = GUICtrlCreateLabel("Socket2 :", 568, 288, 50, 17)
    $socket2 = GUICtrlCreateInput("", 632, 286, 105, 21)

    $Label33 = GUICtrlCreateLabel("Socket3 :", 744, 288, 50, 17)
    $socket3 = GUICtrlCreateInput("", 816, 286, 105, 21)

    $Label34 = GUICtrlCreateLabel("Socket4 :", 16, 328, 50, 17)
    $socket4 = GUICtrlCreateInput("", 80, 326, 105, 21)

    $Label35 = GUICtrlCreateLabel("Socket5 :", 192, 328, 50, 17)
    $socket5 = GUICtrlCreateInput("", 272, 326, 105, 21)

    $Label36 = GUICtrlCreateLabel("Refined_Vnum :", 384, 328, 80, 17)
    $refined_vnum = GUICtrlCreateInput("", 456, 326, 105, 21)

    $Label37 = GUICtrlCreateLabel("Refine_Set :", 568, 328, 63, 17)
    $refine_set = GUICtrlCreateInput("", 632, 326, 105, 21)

    $Label38 = GUICtrlCreateLabel("Magic_Pct :", 744, 328, 61, 17)
    $magic_pct = GUICtrlCreateInput("", 816, 326, 105, 21)

    $Label39 = GUICtrlCreateLabel("Specular :", 16, 368, 52, 17)
    $specular = GUICtrlCreateInput("", 80, 366, 105, 21)

    $Label40 = GUICtrlCreateLabel("Socket_Pct", 192, 368, 60, 17)
    $socket_pct = GUICtrlCreateInput("", 272, 366, 105, 21)

    $Label41 = GUICtrlCreateLabel("Refine_Set2 :", 568, 368, 69, 17)
    $refine_set2 = GUICtrlCreateInput("", 632, 366, 105, 21)

    $Label42 = GUICtrlCreateLabel("Addon_Type :", 384, 368, 71, 17)
    $addon_type = GUICtrlCreateInput("", 456, 366, 105, 21)

    $Label43 = GUICtrlCreateLabel("Name :", 744, 368, 38, 17)
    $name = GUICtrlCreateInput("", 816, 366, 105, 21)

    $Group2 = GUICtrlCreateGroup("Arama", 8, 8, 233, 57, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))

    $Label1 = GUICtrlCreateLabel("İtem kodu :", 18, 34, 54, 17)
    $itemkodu = GUICtrlCreateInput("", 72, 32, 97, 21)

    $Button1 = GUICtrlCreateButton("Ara", 176, 32, 57, 21)

    $Ekle = GUICtrlCreateButton("Ekle", 136, 400, 113, 41)
    $Button2 = GUICtrlCreateButton("Kaydet", 16, 400, 113, 41)

    $kapat2 = GUICtrlCreateButton("Kapat", 256, 400, 113, 41)
    GUICtrlSetOnEvent($kapat2, "_kapat")
    GUISetState(@SW_SHOW)

    func _kapat ()
    Exit
    EndFunc

    Sleep (1)


    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    $mysql=_MySQLConnect("root","12345","player","192.168.1.100")
    _Query($mysql, "select * from item_proto where vnum like '%"&GUICtrlRead($itemkodu)&"%'")
    EndSwitch
    WEnd

    [/code]

    [code]
    [BUDA İNCLUDE ETTİĞİM mysql.au3]

    #include-once

    #cs
    Function Name: _MySQLConnect
    Description: Initiate a connection to a MySQL database.
    Parameter(s): $username - The username to connect to the database with.
    $password - The password to connect to the database with. $Database - Database to connect to.
    $server - The server your database is on.
    $driver (optional) the ODBC driver to use (default is "{MySQL ODBC 3.51 Driver}"
    Requirement(s): Autoit 3 with COM support
    Return Value(s): On success returns the connection object for subsequent functions. On failure returns 0 and sets @error
    @Error = 1
    Error opening connection
    @Error = 2
    MySQL ODBC Driver not installed.
    Author(s): cdkid
    #ce

    Func _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver = "{MySQL ODBC 3.51 Driver}", $iPort=3306)
    Local $v = StringMid($sDriver, 2, StringLen($sDriver) - 2)
    Local $key = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $val = RegRead($key, $v)
    If @error or $val = "" Then
    SetError(2)
    Return 0
    EndIf
    $ObjConn = ObjCreate("ADODB.Connection")
    $Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)
    If @error Then
    SetError(1)
    Return 0
    Else
    Return $ObjConn
    EndIf
    EndFunc ;==>_MySQLConnect

    #cs
    Function name: _Query
    Description: Send a query to the database
    Parameter(s): $oConnectionObj - As returned by _MySQLConnect. $query - The query to execute
    Return Value(s):On success returns the query result. On failure returns 0 and sets @error to 1
    Requirement(s):Autoit3 with COM support
    Author(s): cdid
    #ce


    Func _Query($oConnectionObj, $sQuery)
    If IsObj($oConnectionObj) Then
    Return $oConnectionobj.execute ($sQuery)
    EndIf
    If @error Then
    SetError(1)
    Return 0
    EndIf

    EndFunc ;==>_Query

    #cs
    Function name: _MySQLEnd
    Description: Closes the database connection (see notes!)
    Parameter(s): $oConnectionObj - The connection object as returned by _MySQLConnect()
    Requirement(s):Autoit 3 with COM support
    Return Value(s):On success returns 1. On failure returns 0 and sets @error to 1
    Author(s): cdkid
    #ce

    Func _MySQLEnd($oConnectionObj)
    If IsObj($oConnectionObj) Then
    $oConnectionObj.close
    Return 1
    Else
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_MySQLEnd

    #cs
    Function name: _AddRecord
    Description: Adds a record to the specified table
    Note(s): to add to multiple columns use an array with one blank element at the end as the $sColumn, and $value parameter
    Parameter(s): $oConnectionObj - As returned by _MySQL Connect. $sTable - The table to put the record in
    $row - The row to put the record in. $value - The value to put into the row
    $vValue - OPTIONAL default will be default for the column (will not work with array, see notes)
    Requirement(s): Autoit 3 with COM support
    Return value(s): On success returns 1. If the connectionobj is not an object returns 0 and sets @error to 2. If there is any other error returns 0 and sets @error to 1.
    Author(s): cdkid
    #ce

    Func _AddRecord($oConnectionObj, $sTable, $vRow, $vValue = "")
    If IsObj($oConnectionObj) Then
    $query = "INSERT INTO " & $sTable & " ("

    If IsArray($vRow) Then
    For $i = 0 To UBound($vRow, 1) - 1
    If $i > 0 And $i <> UBound($vRow, 1) - 1 Then
    $query = $query & "," & $vRow[$i] & ""
    ElseIf $i = UBound($vRow, 1) - 1 And $vRow[$i] <> "" Then
    $query = $query & "," & $vRow[$i] & ") VALUES("
    ElseIf $i = 0 Then
    $query = $query & "" & $vRow[$i] & ""
    ElseIf $vRow[$i] = "" Then
    $query = $query & ") VALUES("
    EndIf
    Next
    EndIf
    If Not IsArray($vRow) And Not IsArray($vValue) And Not IsInt($vValue) Then
    $oConnectionobj.execute ("INSERT INTO " & $sTable & " (" & $vRow & ") VALUES('" & $vValue & "')")
    return 1
    ElseIf IsInt($vValue) And Not IsArray($vRow) And Not IsArray($vValue) Then
    $oconnectionobj.execute ("INSERT INTO " & $sTable & " (" & $vRow & ") VALUES(" & $vValue & ")")
    return 1
    EndIf

    If IsArray($vValue) Then
    For $i = 0 To UBound($vValue, 1) - 1
    If $i > 0 And $i <> UBound($vValue, 1) - 1 And Not IsInt($vValue[$i]) Then
    $query = $query & ",'" & $vValue[$i] & "'"
    ElseIf $i = UBound($vValue, 1) - 1 And $vValue[$i] <> "" And Not IsInt($vValue[$i]) Then
    $query = $query & ",'" & $vValue[$i] & "');"
    ElseIf $i = 0 And Not IsInt($vValue[$i]) Then
    $query = $query & "'" & $vValue[$i] & "'"
    ElseIf $vValue[$i] = "" Then
    $query = $query & ");"
    ElseIf IsInt($vValue[$i]) And $vValue[$i] <> "" Then
    $query = $query & "," & $vValue[$i]
    EndIf
    Next
    EndIf
    If StringRight($query, 2) <> ");" Then
    $query = $query & ");"

    EndIf
    $oconnectionobj.execute ($query)
    EndIf
    If Not IsObj($oConnectionObj) Then
    SetError(2)
    Return 0
    EndIf
    If @error And IsObj($oConnectionObj) Then
    Return 0
    SetError(1)
    Else
    Return 1
    EndIf

    EndFunc ;==>_AddRecord


    #cs
    Function name: _DeleteRecord
    Description: Deletes a record from the specified table
    Parameter(s): $oConnectionObj - As returned by _MySQLConnect. $sTable - The table to delete from.
    $sColumn - The column to check value (see the example in the next post) $vRecordVal -
    The value to check in $sColumn (see example).
    $iLimit (optional) - the max number of record to delete if multiple match the criteria (default 1)
    Return Value(s): On success returns 1. If there $oConnectionObj is not an object returns 0 and sets @error to 1. If there are any other errors returns 0 and sets @error to 2
    Requirement(s): Autoit 3 with COM support
    #ce

    Func _DeleteRecord ($oConnectionObj, $sTable, $sColumn, $vRecordVal, $iLimit = 1)
    If IsObj($oConnectionObj) And Not IsInt($vRecordVal) Then
    $oconnectionobj.execute ("DELETE FROM " & $sTable & " WHERE " & $sColumn & " = '" & $vRecordVal & "' LIMIT " & $iLimit & ";")
    ElseIf IsInt($vRecordVal) Then
    $oconnectionobj.execute ("DELETE FROM " & $sTable & " WHERE " & $sColumn & " = " & $vRecordVal & " LIMIT " & $iLimit & ";")
    If Not @error Then
    Return 1
    ElseIf Not IsObj($oConnectionObj) Then
    SetError(1)
    Return 0
    ElseIf @error And IsObj($oConnectionObj) Then
    SetError(2)
    Return 0
    EndIf
    EndIf
    EndFunc ;==>_DeleteRecord

    #cs
    Function name: _CreateTable()
    Description: Creates a table
    Parameters: $oConnectionObj - as returned by _MySQLConnect, $sTbl - The name of the table to create, $sPrimeKey - The name of the
    primary key column. $keytype - The datatype of the primary key (default is integer), $sNotNull - "yes" = must be filled out whenever
    a record is added "no" does not need to be filled out ("yes" default). $keyautoinc - "yes" = Auto incrememnts "no" = does not.
    $sType - The table type (default is InnoDB)
    Requirements: Autoit V3 with COM support
    Return value(s): on success returns 1 on failure sets @error to 1 and returns 0
    Author: cdkid
    #ce

    Func _CreateTable($oConnectionObj, $sTbl, $sPrimeKey, $keytype = "INTEGER", $sNotNull = "yes", $keyautoinc = "yes", $sType = "InnoDB")
    If IsObj($oConnectionObj) And Not @error Then
    $str = "CREATE TABLE " & $sTbl & " " & "(" & $sPrimeKey & " " & $keytype & " UNSIGNED"
    If $sNotNull = "yes" Then
    $str = $str & " NOT NULL"
    EndIf

    If $keyautoinc = "yes" Then
    $str = $str & " AUTO_INCREMENT,"
    EndIf

    $str = $str & " PRIMARY KEY (" & $sPrimeKey & " )" & " ) " & "TYPE = " & $sType & ";"
    $oConnectionObj.execute ($str)
    Return 1


    ElseIf @error Then
    Return 0
    SetError(1)
    EndIf

    EndFunc ;==>_CreateTable

    #cs
    Function Name: _CreateColumn
    Description: Creates a column in the given table
    Requirements: AutoitV3 with COM support
    Parameters: $oConnectionObj - as returned by _MySQLConnect. $sTable - the name of the table to add the column to.
    $sAllowNull - if 'yes' then does not add 'NOT NULL' to the SQL statement (default 'yes') $sDataType - The data type of the column
    default('VARCHAR(45)'). $sAutoInc - if 'yes' adds 'AUTO_INCREMENT' to the MySQL Statement (for use with Integer types)
    default('no'). $sUnsigned - if 'yes' adds 'UNSIGNED' to the MySQL statement. default('no') $vDefault - the default value of the column
    default('')
    Author: cdkid
    #ce

    Func _CreateColumn($oConnectionObj, $sTable, $sColumn, $sAllowNull = "no", $sDataType = "VARCHAR(45)", $sAutoInc = "no", $sUnsigned = "no", $vDefault = '')
    If IsObj($oConnectionObj) And Not @error Then
    $str = "ALTER TABLE `" & $sTable & "` ADD COLUMN `" & $sColumn & "` " & $sDataType & " "
    If $sAllowNull = "yes" Then
    $str = $str & "NOT NULL "
    EndIf
    If $sAutoInc = 'yes' Then
    $str = $str & "AUTO_INCREMENT "
    EndIf
    If $sUnsigned = 'yes' Then
    $str = $str & "UNSIGNED "
    EndIf
    $str = $str & "DEFAULT '" & $vDefault & "';"
    $oConnectionObj.execute ($str)
    Return 1
    Else
    SetError(1)
    Return 0
    EndIf

    EndFunc ;==>_CreateColumn

    #cs
    Function Name: _DropCol()
    Description: Delete a column from the given table
    Requirements: AutoitV3 with COM support
    Parameters: $oConnectionObj - As returned by _MySQLConnect(). $sTable - The name of the table to delete the column from
    $sColumn - THe name of the column to delete
    Author: cdkid
    #ce

    Func _DropCol($oConnectionObj, $sTable, $sColumn)
    If IsObj($oConnectionObj) & Not @error Then
    $oConnectionObj.execute ("ALTER TABLE " & $sTable & " DROP COLUMN " & $sColumn & ";")
    Return 1
    ElseIf @error Then
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_DropCol

    #cs
    Function Name: _DropTbl()
    Description: Deletes a table from the database
    Requirements: AutoitV3 with COM support
    Parameters: $oConnectionObj - As returned by _MySQLConnect. $sTable - The name of the table to delete
    Author: cdkid
    #ce

    Func _DropTbl($oConnectionObj, $sTable)
    If IsObj($oConnectionObj) And Not @error Then
    $oConnectionObj.execute ("DROP TABLE " & $sTable & ";")
    Return 1
    Else
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_DropTbl


    #cs
    Function name: _CountRecords()
    Description: Get the number of records in the specified column
    Parameters: $oConnectionObj - As returned by _MySQLConnect. $sTable - The name of the table that the column is in
    $value - If not = "" then it is put in the select statement in the WHERE clause (default "")
    Return value(s): On success returns the number of records. On failure sets @error to 1 and returns 0
    Author: cdkid
    #ce
    Func _CountRecords($oConnectionObj, $sTable, $sColumn, $vValue = '')
    If IsObj($oConnectionObj) And Not @error Then

    If $sColumn <> "" And $vValue <> "" And Not IsInt($vValue) Then
    $constr = "SELECT " & $sColumn & " FROM " & $sTable & " WHERE " & $sColumn & " = '" & $vValue & "'"
    ElseIf $sColumn <> "" And $vValue = '' And Not IsInt($vValue) Then
    $constr = "SELECT " & $sColumn & " FROM " & $sTable
    ElseIf IsInt($vValue) And $sColumn <> '' And $vValue <> '' Then
    $constr = "SELECT " & $sColumn & " FROM " & $sTable & " WHERE " & $sColumn & " = " & $vValue
    EndIf
    $sql2 = ObjCreate("ADODB.Recordset")
    $sql2.cursorlocation = 3
    $sql2.open ($constr, $oConnectionObj)
    With $sql2
    $ret = .recordcount
    EndWith
    $sql2.close
    Return $ret
    Else
    SetError(1)
    Return 0
    EndIf
    EndFunc ;==>_CountRecords

    #cs
    Function name: _CountTables
    Description: Counts the number of tables in the database
    Parameter(s): $oConnectionObj - As returned by _MySQLConnect
    Return value(s): if error - returns 0 and sets @error to 1. on success returns the number of tables in the database
    Author: cdkid
    #ce

    Func _CountTables($oConnectionObj)
    If IsObj($oConnectionObj) Then
    $quer = $oConnectionObj.execute ("SHOW TABLES;")
    $i = 0
    With $quer
    While Not .EOF
    $i = $i + 1
    .MoveNext
    WEnd
    EndWith
    Return $i
    EndIf
    If @error Then
    SetError(1)
    Return 0
    EndIf

    EndFunc ;==>_CountTables

    #cs
    Function name: _GetColNames
    Description: Get's the names of all columns in a specified table
    Parameters: $oConnectionObj - As returned by _MySQLConnect. $sTable - The name of the table to get the column names from
    Return values: On success returns an array where $array[0] is the number of elements in the array and all the rest are column names.
    On failure returns 0 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetColNames($oConnectionObj, $sTable)
    If IsObj($oConnectionObj) And Not @error Then
    Dim $ret[1], $rs

    $rs = $oConnectionObj.execute ("SHOW COLUMNS FROM " & $sTable & ";")

    With $rs
    While Not .EOF

    ReDim $ret[UBound($ret, 1) + 1]
    $ret[UBound($ret, 1) - 1] = $rs.Fields (0).Value
    .MoveNext
    WEnd
    EndWith
    $ret[0] = UBound($ret, 1) - 1
    Return $ret
    EndIf
    If @error Then
    Return 0
    SetError(1)
    EndIf
    EndFunc ;==>_GetColNames


    #cs
    Function name: _GetTblNames
    Description: Gets the names of all tables in the database
    Parameters: $oConnectionObj - As returned by _MySQLConnect
    Return value(s): On success returns an array where $array[0] is the number of tables and $array[n] is the nth table's name
    on failure - returns 0 and sets @error to 1
    Author: cdkid
    #ce

    Func _GetTblNames($oConnectionObj)
    If IsObj($oConnectionObj) Then
    Dim $ret[1]
    $quer = $oConnectionObj.execute ("SHOW TABLES;")
    With $quer
    While Not .eof
    ReDim $ret[UBound($ret, 1) + 1]
    $ret[UBound($ret, 1) - 1] = .fields (0).value
    .movenext
    WEnd
    EndWith
    $ret[0] = UBound($ret, 1) - 1
    Return $ret
    EndIf
    EndFunc ;==>_GetTblNames

    #cs
    Function name: _GetColVals
    Description: Gets all of the values of a specified column in a specified table
    Parameters: $oConnectionObj - As returned by _MySQLConnect(), $sTable - the table that the column is in
    $sColumn - the column to get values from.
    Return value(s): On success returns an array where $array[0] is the number of values and $array[n] is the Nth value
    On failure sets @error to 1 and returns 0
    Author: cdkid
    #ce

    Func _GetColVals($oConnectionObj, $sTable, $sColumn)
    If IsObj($oConnectionObj) Then
    Dim $ret[1]
    $quer = $oConnectionObj.execute ("SELECT " & $sColumn & " FROM " & $sTable & ";")
    With $quer
    While Not .EOF
    ReDim $ret[UBound($ret, 1) + 1]
    $ret[UBound($ret, 1) - 1] = .Fields (0).value
    .MoveNext
    WEnd
    EndWith
    $ret[0] = UBound($ret, 1) - 1
    Return $ret
    EndIf
    EndFunc ;==>_GetColVals

    #cs
    Function name: _GetColCount
    Description: Gets the number of columns in the specified table
    Parameters: $oConnectionObj - As returned by _MySQLConnect(). $sTable - the table to count the columns in
    Return Value(s): On success returns the number of columns in the table. On failure returns -1 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetColCount($oConnectionObj, $sTable)
    If IsObj($oConnectionObj) Then
    $quer = $oConnectionObj.execute ("SHOW COLUMNS IN " & $sTable)
    With $quer
    $i = 0
    While Not .eof
    $i = $i + 1
    .movenext
    WEnd
    EndWith
    Return $i
    EndIf
    If @error Then
    Return -1
    SetError(1)
    EndIf

    EndFunc ;==>_GetColCount

    #cs
    Function name: _GetColType
    Description: Gets the DATA TYPE of the specified column
    Parameters: $oConnectionObj - As returned by _MySQLConnect(). $sTable - the table that the column is in. $sColumn - the column
    to retrieve the data type from.
    Return value(s): On success returns the data type of the column. On failure returns 0 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetColType($oConnectionObj, $sTable, $sColumn)
    If IsObj($oConnectionObj) Then
    $quer = $oConnectionObj.execute ("SHOW COLUMNS IN " & $sTable)
    With $quer
    $i = 0
    While Not .eof
    If .fields (0).value = $sColumn Then
    $ret = .fields (1).value
    EndIf
    .MoveNext
    WEnd
    EndWith
    Return $ret
    EndIf
    If @error Then
    Return 0
    SetError(1)
    EndIf
    EndFunc ;==>_GetColType

    #cs
    Function: _GetDBNames
    Description: Get a count and list of all databases on current server.
    Parameters: $oConObj - As returned by _MySQLConnect
    Return Value(s): Success - An array where $array[0] is the number of databases and $array[n] is the nth database name.
    Failure - -1 and sets @error to 1
    Author: cdkid
    #ce
    Func _GetDBNames($conobj)
    If IsObj($conobj) Then
    Local $arr[1], $m
    $m = $conobj.Execute ("SHOW DATABASES;")
    With $m
    While Not .eof
    ReDim $arr[UBound($arr, 1) + 1]
    $arr[UBound($arr, 1) - 1] = .Fields (0).Value
    .MoveNext
    WEnd
    EndWith
    $arr[0] = UBound($arr, 1) - 1
    Return $arr
    Else
    SetError(1)
    Return -1
    EndIf
    EndFunc ;==>_GetDBNames

    #cs
    Function: _ChangeCon
    Description: Change your connection string
    Parameters:
    $oConnectionObj
    As returned by _MySQLConnect
    $username
    OPTIONAL: the new username to use
    If omitted, the same username will be used.
    $password
    OPTIONAL: the new password to use
    If omitted, the same password will be used.
    $database
    OPTIONAL: the new database to connect to
    If omitted, the same database will be used.
    $driver
    OPTIONAL: the new driver to use
    If omitted, the MySQL ODBC 3.51 DRIVER will be used.
    $server
    OPTIONAL: the new server to connect to
    If omitted, the same server will be used.
    $iPort
    OPTIONAL: the new port to be used to connect
    if omitted, the default port (3306) will be used
    Return Value:
    On success, a new connection object for use with subsequent functions.
    On failure, -1 and sets @error to 1
    Author: cdkid
    #ce

    Func _ChangeCon($oConnectionObj, $username = "", $password = "", $database = "", $driver = "", $server = "", $iPort = 0)
    Local $constr, $db, $usn, $pwd, $svr
    If IsObj($oConnectionObj) Then
    $constr = $oConnectionObj.connectionstring
    $constr = StringReplace($constr, 'Provider=MSDASQL.1;Extended Properties="', '')
    $constr = StringSplit($constr, ";")
    For $i = 1 To $constr[0]
    If StringLeft($constr[$i], 3) = "UID" Then
    If $username <> "" Then
    $usn = $username
    Else
    $usn = StringMid($constr[$i], 5)
    EndIf
    $usn = StringTrimRight($usn, 1)
    EndIf
    If StringLeft($constr[$i], 3) = "PWD" Then
    If $password <> "" Then
    $pwd = $password
    Else
    $pwd = StringMid($constr[$i], 5)
    EndIf
    EndIf
    If StringLeft($constr[$i], 8) = "DATABASE" Then
    If $database <> "" Then
    $db = $database
    Else
    $db = StringMid($constr[$i], 10)
    EndIf
    EndIf
    If StringLeft($constr[$i], 6) = "SERVER" Then
    If $server <> "" Then
    $svr = $server
    Else
    $svr = StringMid($constr[$i], 8)
    EndIf
    EndIf
    If StringLeft($constr[$i], 6) = "DRIVER" Then
    If $driver <> "" Then
    $dvr = $driver
    Else
    $dvr = "{MySQL ODBC 3.51 DRIVER}"
    EndIf
    EndIf
    If StringLeft($constr[$i], 4) = "PORT" Then
    if $iport <> 0 Then
    $port = $iport
    Else
    $port = 3306
    EndIf
    EndIf
    Next
    $oConnectionObj.close
    $oConnectionObj.Open ("DATABASE=" & $db & ";DRIVER=" & $dvr & ";UID=" & $usn & ";PWD=" & $pwd & ";SERVER=" & $svr & ";PORT=" & $port & ";")
    Return $oConnectionObj
    Else
    SetError(1)
    Return -1
    EndIf
    EndFunc ;==>_ChangeCon



    [/code]


    bunlarda DB'mde yer alan üst satırdaki isimler vnum gibi

    [code]vnum
    locale_name
    type
    subtype
    weight
    size
    antiflag
    flag
    wearflag
    immuneflag
    gold
    shop_buy_price
    limittype0
    limitvalue0
    limittype1
    limitvalue1
    applytype0
    applyvalue0
    applytype1
    applyvalue1
    applytype2
    applyvalue2
    value0
    value1
    value2
    value3
    value4
    value5
    socket0
    socket1
    socket2
    socket3
    socket4
    socket5
    refined_vnum
    refine_set
    magic_pct
    specular
    socket_pct
    addon_type
    refine_set2
    name[/code]
  2. Beyler k.bakmayın autoit ile alakalı çok fazla bir bilgim yok koda form desinger programı ile yaptığım tasarım a mysql alanımdan veri çekip düzenleyip geri kaydetmek için bir çalışma yaptım fakat komut kodlarından hiç anlamıyorum bu anlatmaya çalıştığım şey mysql alanımda şöyle yer almakta

    DB min yolu

    Player sekmesinin içinde item_proto dosyası

    Player>item_proto

    ben bu
    item protonun içinden vnum bölmesinden kod aratıcam üstteki ara butonu onun içinden arıyor

    [img]http://www.tnctr.com/uploads/imgs/pre_1310892777__adsz.png[/img]

    DB'deki tablonun resmi burdan msla 11299 u arattım ordan program kendi içinden bulsun soldaki type subtype fln gibi yerleri yerlerine göre sıralasın formdaki yaptığım gibi sırası değişik olması gerekiyorda

    [img]http://www.tnctr.com/uploads/imgs/pre_1310893194__adsz.png[/img]

    birde alt tarafa yeni diye buton koymuştum oda arama yapmadan alanları doldurduğumda yeni bir satır oluşturabilirmiyiz

    yardımlarınız için çok teşekkürler harika bir forum formun kodları

    [code]#include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    GUISetState(@SW_SHOW)
    $Form1_1 = GUICreate("X-Virus İtem Proto Editor", 1018, 456, 155, 112, -1)
    $Group1 = GUICtrlCreateGroup("Bilgiler", 8, 64, 1001, 385, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))

    $Label2 = GUICtrlCreateLabel("Vnum :", 16, 88, 37, 17)
    $vnum = GUICtrlCreateInput("", 64, 86, 105, 21)

    $Label3 = GUICtrlCreateLabel("Locale_Name :", 184, 88, 76, 17)
    $local_name = GUICtrlCreateInput("", 256, 86, 105, 21)

    $Label4 = GUICtrlCreateLabel("Type :", 368, 88, 34, 17)
    $type = GUICtrlCreateInput("", 408, 86, 105, 21)

    $Label5 = GUICtrlCreateLabel("Subtype :", 520, 88, 49, 17)
    $subtype = GUICtrlCreateInput("", 576, 86, 105, 21)

    $Label6 = GUICtrlCreateLabel("Weight :", 688, 88, 44, 17)
    $weight = GUICtrlCreateInput("", 736, 86, 105, 21)

    $Label7 = GUICtrlCreateLabel("Size :", 848, 88, 30, 17)
    $size = GUICtrlCreateInput("", 896, 86, 105, 21)

    $Label8 = GUICtrlCreateLabel("Antiflag :", 16, 128, 45, 17)
    $antiflag = GUICtrlCreateInput("", 64, 126, 105, 21)

    $Label9 = GUICtrlCreateLabel("Flag :", 184, 128, 30, 17)
    $flag = GUICtrlCreateInput("", 256, 126, 105, 21)

    $Label10 = GUICtrlCreateLabel("W.Flag :", 368, 128, 44, 17)
    $wearflag = GUICtrlCreateInput("", 408, 126, 105, 21)

    $Label11 = GUICtrlCreateLabel("İm.Flag :", 520, 128, 44, 17)
    $immuneflag = GUICtrlCreateInput("", 576, 126, 105, 21)

    $Label12 = GUICtrlCreateLabel("Gold :", 688, 128, 32, 17)
    $gold = GUICtrlCreateInput("", 736, 126, 105, 21)

    $Label13 = GUICtrlCreateLabel("B.Price :", 848, 128, 44, 17)
    $shop_buy_price = GUICtrlCreateInput("", 896, 126, 105, 21)

    $Label14 = GUICtrlCreateLabel("Limittype0 :", 16, 168, 57, 17)
    $limittype0 = GUICtrlCreateInput("", 80, 166, 105, 21)

    $Label15 = GUICtrlCreateLabel("Limitvalue0 :", 192, 168, 63, 17)
    $limitvalue0 = GUICtrlCreateInput("", 272, 166, 105, 21)

    $Label16 = GUICtrlCreateLabel("Limittype1 :", 384, 168, 57, 17)
    $limittype1 = GUICtrlCreateInput("", 456, 166, 105, 21)

    $Label17 = GUICtrlCreateLabel("LimittypeV.1 :", 568, 168, 67, 17)
    $limitvalue1 = GUICtrlCreateInput("", 632, 166, 105, 21)

    $Label18 = GUICtrlCreateLabel("Applytype0 :", 744, 168, 62, 17)
    $applytype0 = GUICtrlCreateInput("", 816, 166, 105, 21)

    $Label19 = GUICtrlCreateLabel("ApplyV.0 :", 16, 208, 52, 17)
    $applyvalue0 = GUICtrlCreateInput("", 80, 206, 105, 21)

    $Label20 = GUICtrlCreateLabel("Applytype1 :", 192, 208, 62, 17)
    $applytype1 = GUICtrlCreateInput("", 272, 206, 105, 21)

    $Label21 = GUICtrlCreateLabel("ApplyV.1 :", 384, 208, 52, 17)
    $applyvalue1 = GUICtrlCreateInput("", 456, 206, 105, 21)

    $Label22 = GUICtrlCreateLabel("Applytype2 :", 568, 208, 62, 17)
    $applytype2 = GUICtrlCreateInput("", 632, 206, 105, 21)

    $Label23 = GUICtrlCreateLabel("Apply.V.2 :", 744, 208, 55, 17)
    $applyvalue2 = GUICtrlCreateInput("", 816, 206, 105, 21)

    $Label24 = GUICtrlCreateLabel("Value0 :", 16, 248, 43, 17)
    $value0 = GUICtrlCreateInput("", 80, 246, 105, 21)

    $Label25 = GUICtrlCreateLabel("Value1 :", 192, 248, 43, 17)
    $value1 = GUICtrlCreateInput("", 272, 246, 105, 21)

    $Label26 = GUICtrlCreateLabel("Value2 :", 384, 248, 43, 17)
    $value2 = GUICtrlCreateInput("", 456, 246, 105, 21)

    $Label27 = GUICtrlCreateLabel("Value3 :", 568, 248, 43, 17)
    $value3 = GUICtrlCreateInput("", 632, 246, 105, 21)

    $Label28 = GUICtrlCreateLabel("Value4 :", 752, 248, 43, 17)
    $value4 = GUICtrlCreateInput("", 816, 246, 105, 21)

    $Label29 = GUICtrlCreateLabel("Value5 :", 16, 288, 43, 17)
    $value5 = GUICtrlCreateInput("", 80, 286, 105, 21)

    $Label30 = GUICtrlCreateLabel("Socket0 :", 192, 288, 50, 17)
    $socket0 = GUICtrlCreateInput("", 272, 286, 105, 21)

    $Label31 = GUICtrlCreateLabel("Socket1 :", 384, 288, 50, 17)
    $socket1 = GUICtrlCreateInput("", 456, 286, 105, 21)

    $Label32 = GUICtrlCreateLabel("Socket2 :", 568, 288, 50, 17)
    $socket2 = GUICtrlCreateInput("", 632, 286, 105, 21)

    $Label33 = GUICtrlCreateLabel("Socket3 :", 744, 288, 50, 17)
    $socket3 = GUICtrlCreateInput("", 816, 286, 105, 21)

    $Label34 = GUICtrlCreateLabel("Socket4 :", 16, 328, 50, 17)
    $socket4 = GUICtrlCreateInput("", 80, 326, 105, 21)

    $Label35 = GUICtrlCreateLabel("Socket5 :", 192, 328, 50, 17)
    $socket5 = GUICtrlCreateInput("", 272, 326, 105, 21)

    $Label36 = GUICtrlCreateLabel("Refined_Vnum :", 384, 328, 80, 17)
    $refined_vnum = GUICtrlCreateInput("", 456, 326, 105, 21)

    $Label37 = GUICtrlCreateLabel("Refine_Set :", 568, 328, 63, 17)
    $refine_set = GUICtrlCreateInput("", 632, 326, 105, 21)

    $Label38 = GUICtrlCreateLabel("Magic_Pct :", 744, 328, 61, 17)
    $magic_pct = GUICtrlCreateInput("", 816, 326, 105, 21)

    $Label39 = GUICtrlCreateLabel("Specular :", 16, 368, 52, 17)
    $specular = GUICtrlCreateInput("", 80, 366, 105, 21)

    $Label40 = GUICtrlCreateLabel("Socket_Pct", 192, 368, 60, 17)
    $socket_pct = GUICtrlCreateInput("", 272, 366, 105, 21)

    $Label41 = GUICtrlCreateLabel("Refine_Set2 :", 568, 368, 69, 17)
    $refine_set2 = GUICtrlCreateInput("", 632, 366, 105, 21)

    $Label42 = GUICtrlCreateLabel("Addon_Type :", 384, 368, 71, 17)
    $addon_type = GUICtrlCreateInput("", 456, 366, 105, 21)

    $Label43 = GUICtrlCreateLabel("Name :", 744, 368, 38, 17)
    $name = GUICtrlCreateInput("", 816, 366, 105, 21)

    $Group2 = GUICtrlCreateGroup("Arama", 8, 8, 233, 57, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))

    $Label1 = GUICtrlCreateLabel("İtem kodu :", 18, 34, 54, 17)
    $itemkodu = GUICtrlCreateInput("", 72, 32, 97, 21)

    $Button1 = GUICtrlCreateButton("Ara", 176, 32, 57, 21)

    $Ekle = GUICtrlCreateButton("Ekle", 136, 400, 113, 41)
    $Button2 = GUICtrlCreateButton("Kaydet", 16, 400, 113, 41)

    $kapat2 = GUICtrlCreateButton("Kapat", 256, 400, 113, 41)
    GUICtrlSetOnEvent($kapat2, "_kapat")
    GUISetState(@SW_SHOW)

    func _kapat ()
    Exit
    EndFunc

    Sleep (1)


    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    case $Button1
    $mysql=_MySQLConnect("root","12345","player","192.168.1.100")
    _Query($mysql, "select * from item_proto where vnum like '%"&GUICtrlRead($itemkodu)&"%'")
    EndSwitch
    WEnd

    [/code]

    bunlarda DB'mde yer alan üst satırdaki isimler vnum gibi

    [code]vnum
    locale_name
    type
    subtype
    weight
    size
    antiflag
    flag
    wearflag
    immuneflag
    gold
    shop_buy_price
    limittype0
    limitvalue0
    limittype1
    limitvalue1
    applytype0
    applyvalue0
    applytype1
    applyvalue1
    applytype2
    applyvalue2
    value0
    value1
    value2
    value3
    value4
    value5
    socket0
    socket1
    socket2
    socket3
    socket4
    socket5
    refined_vnum
    refine_set
    magic_pct
    specular
    socket_pct
    addon_type
    refine_set2
    name[/code]
×
×
  • Create New...