|
Below is some script I use to pull data out of a MSsql 2005 DB and dump it to a Excel spread sheet. I know its not mysql but i'm not 100% that something along these lines will not work. '***************************************************************************************** Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adUseClient = 3 Set objConnection = CreateObject("ADODB.Connection") Set objRecordset = CreateObject("ADODB.Recordset") objConnection.Open "Provider=SQLOLEDB.1;Initial Catalog=database_name;Data Source=computer_name\sql_instance;Persist Security Info=False;user id=sa; password=sa" 'objConnection.Open "Provider=SQLOLEDB.1;Initial Catalog=database_name;Data Source=computer_name\sql_instance;Persist Security Info=False;Integrated Security=SSPI;" 'use for windows login objRecordset.CursorLocation = adUseClient objRecordset.Open "SELECT * FROM Table", objConnection, adOpenStatic, adLockOptimistic set excel = createobject("excel.application") excel.visible = true excel.workbooks.add introw = 2 if objrecordset.recordcount <> 0 then objRecordset.movefirst do until objRecordset.eof excel.cells(introw,1).value = objRecordset.fields("column").value objRecordset.movenext introw = introw+1 loop else msgbox "No Data" end if objRecordset.Close objConnection.Close
< Message edited by buck2825 -- 11/7/2008 3:51:55 AM >
|