Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Understanding CursorAdapter methods
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01475311
Message ID:
01475333
Views:
25
>>>>>>>Here Alexey just use DATASOURCE_ASSIGN to create a temporary SP in the SQL Server named #Get_ValHelper.
>>>>>>
>>>>>>Then, do you I understand correctly that without creating this temporary SP, the code in BeforeInsert won't work?
>>>>>
>>>>>It would not work, but you can create a permanent sp with the similar code and call it instead. The only purpose of this temp SP is to return the passed value back as output parameter. It's too tricky, but I tried to change InsertCmd directly to simply append select scope_indentity() (as we do in ASP.NET) and it didn't work.
>>>>>
>>>>>But may be using Stored procedure for InsertCmd that will return new ID will work?
>>>>
>>>>Thank you. I would prefer not to add the code DATASOURCE_ASSIGN (just does not feel right; does not mean it is not right). And your suggestion to create a permanent SP is not a bad idea. I wish, as you already tried, that the setting of the identity column could be done right in the InsertCmd though.
>>>
>>>I haven't tried, but I suggest you to try creating an SP that will do your insert and return ID (unless, of course, you generate this insert command on the fly in CA itself).
>>
>>I am still having problem getting the necessary result. A question. Is this the right way of calling a stored procedure get_identity_value from my VFP code?:
>>
>>
>>	cInsertCmd = cInsertCmd + ;  
>>		"; DECLARE @id int; SELECT @id = SCOPE_IDENTITY()" + ;  
>>		"; EXEC Get_Identity_value @id, ?@" + ;  
>>		this.Alias + "." + ALLTRIM(this.IDENTITY_Field) 
>>
>
>The code seems to be correct.

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform