Thanks,
The 'Update" works, but the "Insert Into" does not insert a new record into
the MSSQL table.
Is there a tableupdate command that needs to be issued on the MSSQL table to
enable new records to be added?
Did I mention that the MSSQL table is on a Godaddy web server?
********************************************
m.lcxn = ("Driver={SQL Server}; Server=<server.name>;
Database=<databasename>; Uid=<userid>; Pwd=<password>")
m.lih = Sqlstringconnect(m.lcxn)
*lc_selectcommand = "update hsf_ntf set lastname = 'test' where lastname
= 'Some Name'"
*lc_selectcommand = "insert into hsf_ntf
(postdate,firstname,lastname,email,damname,foalname) values
(DATETIME(),'test','test','test','test','test')"
**************************************************************************
SQLExec(m.lih,lc_selectcommand)
James E Harvey
M.I.S.
Hanover Shoe Farms, Inc.
www.hanoverpa.com
office: 717-637-8931
cell: 717-887-2565
fax: 717-637-6766
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Stephen Russell
Sent: Friday, June 21, 2013 9:34 AM
To: ProFox Email List
Subject: Re: Update MS SQL table from VFP
On Fri, Jun 21, 2013 at 5:51 AM, James Harvey <[email protected]> wrote:
> I've been able to download records from a MS SQL table on the web into
> a local VFP table (see code below).
>
> Now I'd like to learn how to both update records and insert into
> records into the MS SQL table on the web with records obtained from a
> local vfp table using sql.
>
> Researching the web has not been successful, and I was hoping someone
> whose done this could point me in the right direction for
> documentation on how this is done.
>
> Jim
> ---------------
>
You have two options. Presenting insert / Update statement one by one to
SQL Server, you could make a big ole union and have one HUGE statement, or
you can have vfp present an execute stored procedure call that supplies all
the params necessary for that sproc.
Below is a very simple Insert sproc for a table with 5 columns and one is an
primary key generated on insert.
Create PROCEDURE [dbo].[EDIErrors_ins]
@ErrorID numeric (18,0),
@ErrorDesc varchar (150),
@NotifyCustomer bit,
@NotifyAR bit,
@ErrorType varchar (3)
as
Begin
Insert Into [dbo].EDIErrors (
ErrorDesc ,
NotifyCustomer ,
NotifyAR ,
ErrorType
) Values(
@ErrorDesc ,
@NotifyCustomer ,
@NotifyAR ,
@ErrorType
)
end
If you just want to put the insert statement to the db and not use the sproc
that is between the Begin and End above.
Update a SQL stable:
Update EDIErrors
set ErrorDesc = @ErrorDesc ,
NotifyCustomer = @NotifyCustomer ,
NotifyAR =@NotifyAR ,
ErrorType =@ErrorType
where ErrorID = @errorID
--- StripMime Report -- processed MIME parts --- multipart/alternative
text/plain (text body -- kept)
text/html
---
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.