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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.