I am primarily a Visual FoxPro developer with very minimual experience in VB 6 of the official 1 week microsoft class. So I understand some basics. Therefore, please pardon my very basic questions.
I am attempting to write some code to run a query against a MSQL database. I started with the example code shown in Visual Studio MSDN. I have the following questions.
1) What is the simplest (fewest lines of code) to build and run a select statement against MSSQL?
2) The VS MSDN library examples require the following datatypes: DATABASE, WORKSPACE. These are not valid data types in my VB configuration. How/where are these datatypes defined?
examples
Dim dbsCurrent As Database
Dim wrkMain As Workspace
3) In the following example SQL passthrough I'm experimenting with I get error message -2147217865 (80040e37) "Invalid object name smartteam.TN_DEPARTMENT" Where the exact sql statement runs with in SQL enterprise manager.
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=FM;uid=sa;pwd=sa;"
Dim adoPrimaryRS As Recordset
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select OBJECT_ID,DESCRIPTION,VALUE_ORDER from smarteam.TN_DEPARTMENT Order by OBJECT_ID", db, adOpenStatic, adLockOptimistic
Best Regards,
Lee Roy J. Pitre, Jr, AAS, BA, MS
Pitre Computer Consultant & Associates
http://pitres.us