Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old March 11th, 2008, 04:15 PM
filiponder filiponder is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 2 filiponder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 16 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Delphi 7 to MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway