Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Glenn Gevero
  Where is Glenn Gevero?
 Dumaguete
 Philippines
 Glenn Gevero
 To: Ahsan Rana
  Where is Ahsan Rana?
 Lahore
 Pakistan
 Ahsan Rana
 Tags
Subject: RE: Insert Record
Thread ID: 310905 Message ID: 311015 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, June 28, 2011 9:15:24 AM         
   


> Hi Experts
>
> In VFP Table I use the following Code:
>
> ac = Code
> tl = Title
>
> Select TableName
> Set Order to IndexTag
> if !seek(ac)
> Append Blank
> replace Code with ac
> endif
> replace Title with tl
>
> With above code system automatically checks Code if exist then update other add new record in myTable
>
> Now how I can use this type of command in Remote Database e.g. MySql
>
> Thnx in advance
>
> Rgds:
> Ahsan Rana

Hi Ahsan,


SQLEXEC(lnHandle, "SELECT code FROM tablename WHERE code=?ac", "crstemp")

IF RECCOUNT("crstemp") > 0
	SQLEXEC(lnHandle, "UPDATE tablename SET title=?tl WHERE code=?ac")
ELSE
	SQLEXEC(lnHandle, "INSERT INTO tablename (code,title) VALUES (?ac,?tl)")
ENDIF 

=SQLCOMMIT(lnHandle)



----------------------------
with best regards,
Glenn

Everything is possible if you know how to code it... Therefore keep on learning.

http://sourceforge.net/projects/sanggre/

ENTIRE THREAD

Insert Record Posted by Ahsan Rana @ 6/27/2011 6:28:59 AM
RE: Insert Record Posted by Borislav Borissov @ 6/27/2011 8:10:18 AM
RE: Insert Record Posted by Dilip Kumar @ 6/27/2011 8:51:49 AM
RE: Insert Record Posted by onytoo @ 6/27/2011 9:11:29 PM
RE: Insert Record Posted by Glenn Gevero @ 6/28/2011 9:15:24 AM
RE: Insert Record Posted by Stefan Wuebbe @ 6/28/2011 9:52:39 AM