Update via VB Script SQL database from the records used to print labels Follow

0
Avatar
Michael Whiting

I am trying to update all the records I just printed labels for.

My table is t_hjship_request_pkg  

Key value is hjship_shipment_id

In my initial bartender select I include the hjship_shipment_id

Now I want to update all t_hjship_request_pkg where hjship_shipment_id IN (Result values in bartenter)

I can connnect to the DB and manually write an update and hard code value and it works.

But I want to pull values from the Result set in bartender to do my updates.

Is this possible?

I have tried referencing FIELD("AAD.t_hjship_request_pkg.shipment_id") but the double quotes are causing issues with the statement

 

Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=DEV-HJSQL2;Initial Catalog=AAD;user id ='HJS';password='HJSPASS#1'"
Set myConn = CreateObject("ADODB.Connection")
Set myCommand = CreateObject("ADODB.Command" )
myConn.Open DB_CONNECT_STRING
Set myCommand.ActiveConnection = myConn
DIM Mystr
SET Mystr = Field("AAD.t_hjship_request_pkg.shipment_id").Value
myCommand.CommandText = "UPDATE t_hjship_request_pkg SET printin_status = 'P' Where printing_status = 'T' and hjship_shipment_id = '" & Mystr &"' "
myCommand.Execute
myConn.Close

 

 

 

2 comments

0
Avatar
Peter Thane

Sorry this is beyond my programming skills but I believe there maybe something in 2019 (when it is released) that will help out with writing information back into SQL

0
Avatar
xi men

I am running Bartender 2019 R2 version. This problem still exists. What is the reason for this?

Print the data in the selected recorder and update its database value,

Dim SQL
Dim ordno
Set objConn = CreateObject("ADODB.Connection")
set rs = createobject("adodb.recordset")
connstr="DSN=SQL Anywhere 11 Demo;UID=dba;PWD=sql"
objConn.Open connstr
ordno=Format.Objects("print_Description").Value

SQL ="UPDATE products set name='print_oK' where description='" & ordno & "'"

objConn.execute SQL
objConn.close


Why is this statement not updated, is it caused by the assignment of the selected value?
If you write him as a value, you can successfully execute and update the database without any problem.
SQL ="UPDATE products set name='print_oK' where description='V-neck"

Please sign in to leave a comment.