Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About to trap violation error on SQL table
Message
From
01/11/2004 10:12:00
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
00956239
Message ID:
00956546
Views:
9
>Hi,
>
>I have created a Form based on remote view of a table in MS SQL Database, that have a primary key.
>
>If the record is new, after I have enter the primary key, I need to control if the code exist already.
>
>I have not problem with the dbf file, but I have some difficulty with SQL database.
>
>Someone can help me, in order to resolve this problem ?
>
>Thank you.
>
>Best Regards
luNewKey = < key to check >
lnHandle = CursorGetProp("ConnectHandle",'myRemoteViewAlias')
SQLExec(lnHandle,;
  "select count(*) as myCount from myTable where PkID = ?m.luNewKey","crsCheckKey")
llExists = (crsCheckKey.myCount > 0)
PS: If you use GUID as a key you don't need to check.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform