VB6 - rs.execute command help

I'm working on a script that someone else had written and I'm trying to understand what the following lines of code do. I couldn't find anything useful online as I think my search was too broad and I didn't know enough about what was happening in order to narrow it down.

So I understand the IF statement. I'm just not really sure what this execute command is actually doing.


If GetSetting(App.Title, "Settings", "Process", "All") = "All" Then
 db.Execute "Update [" & strExcelInputSheetTab & "$] SET Status = ''"
End If

Open in new window

thach1ef2Asked:
Who is Participating?
 
VBClassicGuyCommented:
The code is reading a registry entry. Specifically:

My Computer\HKEY_CURRENT_USER\Software\VB and VBA Program Settings\YourAppName\Settings\Process\All

where "YourAppName" is of course, the name of your program.

If this registry entry is set to "All", it sets the status to NULL (or empty) of whatever strExcelInputSheetTab is set to.

Looks almost like it is removing the name from the tab on an Excel spreadsheet.
0
 
joachim58Commented:
db.execute in VB6/ADO  is  similar to ExecuteNonQuery
the db-object has an open connection to the database

in ADO .NET 2 it would be:

Dim cmd AS New SQLCommand( conn, "Update [" & strExcelInputSheetTab & "$] SET Status = ''"
cmd.ExecuteNonQuery 

Open in new window


You can add the line

 MsgBox(strExcelInputSheetTab)

Open in new window


to see the information needed to complete the SQL statement.

I cannot say what the dollar sign means. Oracle stores it's data dictionary in tables ending with the dollar sign.










0
 
thach1ef2Author Commented:
I apologize but I still can't tell what the execute command does from your explanation.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
joachim58Commented:
Another hint concerning the $ sign: Someone in my team used the excel to import data from a spreadsheet to a  SQL Server Table, and that generated tablenames that end with a Dollarsign.
0
 
thach1ef2Author Commented:
Haha thank you, however I'm trying to find out what the execute statement is doing. I understand the $ sign and the variable strExcelInputSheetTab. I don't understand what the execute command is doing...
0
 
joachim58Commented:
It executes the SQL statement that is passed as a parameter on the database-connection represented by the db-object.

You need to know the value of strExcelInputSheetTab  to see what SQL statement is actually passed.
0
 
thach1ef2Author Commented:
Thanks VBClassicGuy,

With your help I was able to figure this out.

strExcelInputSheetTab is the name of the sheet in Excel. Either somewhere else in the code this is used to name the database or this happens automatically. Not sure which.

So that statement above is setting all of the entries of the "status" column of the table strExcelInputSheetTab, to null.
0
 
thach1ef2Author Commented:
The response given gave me enough information to figure out the answer.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.