Hello Again,
I have some example script where i can query data from DB and put that data in variable (example script bellow) tested and it works.
But i need to get next available number from specific table with fallowing SQL query:
select IDENT_CURRENT('dbo.dn_delovodna') + IDENT_INCR('dbo.dn_delovodna')
but i don't know how to get returned value from SQL in this case in metadata?
If i put SQL = "select IDENT_CURRENT('dbo.dn_delovodna') + IDENT_INCR('dbo.dn_delovodna')" in the process log i have error:
Error | An error occurred at | line 16, column 0: 3265 | Item cannot be found in the collection corresponding to the requested name or ordinal.
I guess that i need to change line 16 docnumber = Recordset("USERNAME") to something else but what?
##### My Sample Script ######
Dim Connection
Dim SQL
SQL = "SELECT [username] FROM [DN_Test].[dbo].[dn_users] WHERE [ID] = 100"
Set Connection = CreateObject("ADODB.Connection")
Set Recordset = CreateObject("ADODB.Recordset")
Connection.Open "Provider=SQLOLEDB;Data Source=demo-sqlsrv\sqlexpress;Persist Security Info=True;OLE DB Services=-13;Password=*********;User ID=sa;Initial Catalog=DN_Test;Locale Identifier=1033;Connect Timeout=0;General Timeout=0;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WIN-CVF839O6QKM;Use Encryption for Data=False;Tag with column collation when possible=False"
Recordset.Open SQL,Connection
docnumber = Recordset("USERNAME")
Connection.Close
Set Connection=nothing
'Wscript.Echo docnumber
CALL Metadata.SetValues("USERNAME",docnumber)
Many Thanks!
Dusan