I'm trying to connect to an Excel file through ADODB and manipulate it like any other database.
The following code from works just fine:
The source could have also been
I can't figure out how to specify specific fields, so that I can pass parameters or create a recordset with only one or two fields. Usually, you just say "Select Name, Number From myTable" but in this case, Excel doesn't understand that. The myTable becomes [myWorksheet$], but what do Name and Number become?
Christopher
The following code from works just fine:
Code:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "ADOExcel"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = objConn
objRS.CursorType = 3
objRS.LockType = 2
objRS.Source = "Select * from myRange1"
objRS.Open
The source could have also been
Code:
objRS.Source = "Select * from [myWorksheet1$]"
I can't figure out how to specify specific fields, so that I can pass parameters or create a recordset with only one or two fields. Usually, you just say "Select Name, Number From myTable" but in this case, Excel doesn't understand that. The myTable becomes [myWorksheet$], but what do Name and Number become?
Christopher