The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
inserting recoed in SQL Database through SLX
Posted: 16 Jan 08 10:05 AM
|
hello friends,
i have problem in inserting recoed in SQL Database through SLX. i want to know my syntax is correct. please help me. here is my code...
Dim strlstrsql set rsobjCMC = objSLXDB.GetNewRecordSet
strlstrsql = "Select * from Contact_Newletter where 1=2" 'DNL
rsobjCMC.Open strlstrsql, objSLXDB
with rsobjCMC .addnew .Fields("Contact_newletterid").Value=application.BasicFunctions.GetIDFor("Contact_Newletter") .Fields("CreateUser").Value = Application.BasicFunctions.CurrentUserID .Fields("CreateDate").Value = now .Fields("ModifyUser").Value = Application.BasicFunctions.CurrentUserID .Fields("ModifyDate").Value = now .Fields("Subscribed").Value = "C" .Update End With
|
|
|
| |
|
Re: inserting recoed in SQL Database through SLX
Posted: 16 Jan 08 2:36 PM
|
As Rohan mentioned, this line:
rsobjCMC.Open strlstrsql, objSLXDB
is incorrect. Change as mentioned by Rohan or like this:
rsobjCMC.Open strlstrsql, Application.GetNewConnection
Either way should work.
-Ryan |
|
|
|
Re: inserting recoed in SQL Database through SLX
Posted: 16 Jan 08 4:26 PM
|
Recent versions of the OLE DB provider (7 onwards?) perform the update of CREATEUSER, CREATEDATE, MODIFYUSER and MODIFYDATE automatically - so your code can be condensed to the following:
Dim strlstrsql set rsobjCMC = objSLXDB.GetNewRecordSet
strlstrsql = "Select * from Contact_Newletter where 1=2" 'DNL
rsobjCMC.Open strlstrsql, objSLXDB.Connection
with rsobjCMC .addnew .Fields("Contact_newletterid").Value=application.BasicFunctions.GetIDFor("Contact_Newletter") .Fields("Subscribed").Value = "C" .Update End With
Phil |
|
|
| |
|