Hello all,
I need some help with if exists (select * statement. I am trying to use if it exists to update and if the record does not exist to insert it. I am tyring to use asp to MSSQL 7 server. Here is the code below
strwkn = Request.form("wkn"
strsrv = request.form ("srv"
strvslvoy = Request.form("vslvoy"
stretd = Request.form("etd"
SET db = Server.CreateObject("ADODB.Connection"
db.Open "DSN=DSN", "id","pass"
SQL = if exists(select * from vsl where wkn = '" & strwkn & "' and srv = '" & strsrv & "')
"Update vsl set vslvoy='" & strvslvoy & "' Where wkn='" & strwkn & "' and srv='" & strsrv & "', and etd='" & stretd & "'"
ELSE
"Insert into vsl (wkn, vslvoy, srv, etd)Values ('" & strwkn & "', '" & strvslvoy & "', '" & strsrv & "', '" & stretd & "')"
Thanks in advance
I need some help with if exists (select * statement. I am trying to use if it exists to update and if the record does not exist to insert it. I am tyring to use asp to MSSQL 7 server. Here is the code below
strwkn = Request.form("wkn"
strsrv = request.form ("srv"
strvslvoy = Request.form("vslvoy"
stretd = Request.form("etd"
SET db = Server.CreateObject("ADODB.Connection"
db.Open "DSN=DSN", "id","pass"
SQL = if exists(select * from vsl where wkn = '" & strwkn & "' and srv = '" & strsrv & "')
"Update vsl set vslvoy='" & strvslvoy & "' Where wkn='" & strwkn & "' and srv='" & strsrv & "', and etd='" & stretd & "'"
ELSE
"Insert into vsl (wkn, vslvoy, srv, etd)Values ('" & strwkn & "', '" & strvslvoy & "', '" & strsrv & "', '" & stretd & "')"
Thanks in advance