dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Provider = "MSDASQL"
objConn.ConnectionString = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;DBQ=ADOtest2";ReadOnly= false;"
objConn.Open
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = objConn
objRS.CursorType = 3 'Static cursor.
objRS.LockType = 2 'Pessimistic Lock.
objRS.Source = "Select * from myRange1"
objRS.Open
dim X
Response.Write("<TABLE><TR>")
For X = 0 To objRS.Fields.Count - 1
Response.Write("<TD>" & objRS.Fields.Item(X).Name & "</TD>")
Next
Response.Write("</TR>")
objRS.MoveFirst
While Not objRS.EOF
Response.Write("<TR>")
For X = 0 To objRS.Fields.Count - 1
Response.write("<TD>" & objRS.Fields.Item(X).Value)
Next
objRS.MoveNext
Response.Write("</TR>")
Wend
Response.Write("</TABLE>")
Destroy objRS 'custom function
objConn.close
ADOtest2.xls
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE