|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Delphi 7 to MySQL
Hello,
I'm not experianced in programming with Database components. I made Delphi v.7 application that need to verify and change a MySQL database record. I tried to use this program seen in this forum, but I failed to intergrate it with right UPDATE command. ################## 1. Drop a TSQLConnection component on the form. Set the ConnectionName to MySQLConnection and set LoginPrompt to False. Set the Params property to the connection property and then set Connected to True. 2. Drop a TSQLQuery component on the form and set its SQLConnection property to the TSQLConnection component in step 1. Then click on the SQL property and type: SELECT * FROM stdcodes WHERE areacode = :areacode Then click on the Params property and set the DataType and ParamType properties of the areacode param. with SQLQuery1 do begin Close; ParamByName('areacode').Value := somevalue; Open; // Loop thru the result set. while not Eof do begin // Get the values of individual fields in the result set. x := FieldByName('country').AsString; y := FieldByName('areacode').AsInteger; Next; end; end; ############### In My case I have table 'pet', fields - name, owner, species I need my program to make this: UPDATE pet SET owner =ownernew WHERE name =: nameask where ownernew and nameask are variables string types, given from other part of the program. I want this command to be executed only if Name = nameask and owner = 0 (for above match) EXAMPLE TABLE: name owner species Balkan Ben dog Sunshine NULL NULL On the paskal language I need: nameask:=SunShine; ownernew:=Dani; If name = SunShine and owner = NULL then owner = ownernew; RESULT TABLE: name owner species Balkan Ben dog Sunshine Dani NULL Pls help because I'm going crazy. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Delphi 7 to MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|