Click here to Skip to main content
15,889,216 members
Home / Discussions / Database
   

Database

 
GeneralRe: Crystal Report vb.net 2005 !!! Pin
Bassam Saoud28-Jan-07 7:40
Bassam Saoud28-Jan-07 7:40 
GeneralRe: Crystal Report vb.net 2005 !!! Pin
kindman_nb28-Jan-07 22:06
kindman_nb28-Jan-07 22:06 
GeneralRe: Crystal Report vb.net 2005 !!! Pin
kindman_nb29-Jan-07 3:08
kindman_nb29-Jan-07 3:08 
AnswerRe: Crystal Report vb.net 2005 !!! Pin
Jati Indrayanto31-Jan-07 15:20
Jati Indrayanto31-Jan-07 15:20 
Questionadvanced subquery Pin
Bit_flipper27-Jan-07 8:42
Bit_flipper27-Jan-07 8:42 
AnswerRe: advanced subquery Pin
Colin Angus Mackay27-Jan-07 10:21
Colin Angus Mackay27-Jan-07 10:21 
QuestionASP and MS Access Pin
kkhelil27-Jan-07 2:18
kkhelil27-Jan-07 2:18 
AnswerRe: ASP and MS Access Pin
andyharman28-Jan-07 23:17
professionalandyharman28-Jan-07 23:17 
Most people do not run Excel VBA macros from ASP pages (you would need to run OLE automation).

I wrote the following code a couple of years back that may help:
Sub WriteToExcel(objAdoResultSet, strTemplateFile, strNewFilePath)
   Dim objFSO, objExcelConn, objExcelRS, arrData, lngRow, intField

   'Copy the template spreadsheet, and open a recordset.
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   Call objFSO.CopyFile(strTemplateFile, strNewFilePath, True)
   Set objExcelConn = CreateObject("ADODB.Connection")
   Call objExcelConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;" & _
         "Data Source=" & strNewFilePath & ";" & _
         "Extended Properties=""Excel 8.0;HDR=NO""")
   Set objExcelRS = CreateObject("ADODB.RecordSet")
   Call objExcelRS.Open("SELECT * FROM [Sheet1$]", objExcelConn, _
         adOpenKeyset, adLockOptimistic)
   Call objExcelRS.MoveLast() 'Position cursor on formatting row.

   'Write data to the spreadsheet recordset.
   arrData = objAdoResultSet.GetRows()
   With (objExcelRS)
      For lngRow = 0 To UBound(arrData, 2)
         Call .AddNew()
         For intField = 0 To UBound(arrData, 1)
            .Fields(intField).Value = arrData(intField, lngRow)
         Next
         Call .Update()
      Next
   End With

   'Tidy up.
   Call objExcelRS.Close()
   Set objExcelRS = Nothing
End Sub
I have simplified it a bit to make it shorter, and haven't tried running it since. The general principle is that it uses the JET driver to open a writable connection to an Excel spreadsheet, then copies the contents of the passed-in objAdoResultSet into your new connection.

Hope this helps.
Andy
QuestionProblem WITH Data Accss Application Blocks DAAB Pin
adnanrafiq27-Jan-07 1:32
adnanrafiq27-Jan-07 1:32 
AnswerRe: Problem WITH Data Accss Application Blocks DAAB Pin
Colin Angus Mackay27-Jan-07 10:25
Colin Angus Mackay27-Jan-07 10:25 
AnswerRe: Problem WITH Data Accss Application Blocks DAAB Pin
Duncan Edwards Jones29-Jan-07 8:42
professionalDuncan Edwards Jones29-Jan-07 8:42 
Questionhow to insert data into two table when two tables depend on each other? Pin
Tridip Bhattacharjee26-Jan-07 20:54
professionalTridip Bhattacharjee26-Jan-07 20:54 
AnswerRe: how to insert data into two table when two tables depend on each other? Pin
Bassam Saoud26-Jan-07 23:20
Bassam Saoud26-Jan-07 23:20 
QuestionQuerying Distinct Users Pin
Skanless26-Jan-07 14:32
Skanless26-Jan-07 14:32 
AnswerRe: Querying Distinct Users Pin
M.H.1.2.326-Jan-07 20:03
M.H.1.2.326-Jan-07 20:03 
QuestionHow to get max on each row [modified] Pin
xoxoxoxoxoxox26-Jan-07 9:59
xoxoxoxoxoxox26-Jan-07 9:59 
QuestionRe: How to get max on each row Pin
andyharman26-Jan-07 10:03
professionalandyharman26-Jan-07 10:03 
AnswerRe: How to get max on each row Pin
xoxoxoxoxoxox26-Jan-07 10:09
xoxoxoxoxoxox26-Jan-07 10:09 
GeneralRe: How to get max on each row Pin
andyharman26-Jan-07 10:18
professionalandyharman26-Jan-07 10:18 
GeneralRe: How to get max on each row Pin
Michael Potter26-Jan-07 10:31
Michael Potter26-Jan-07 10:31 
GeneralRe: How to get max on each row [modified] Pin
xoxoxoxoxoxox26-Jan-07 11:08
xoxoxoxoxoxox26-Jan-07 11:08 
QuestionInt value as 0001 Pin
javierarka26-Jan-07 9:40
javierarka26-Jan-07 9:40 
AnswerRe: Int value as 0001 Pin
andyharman26-Jan-07 9:52
professionalandyharman26-Jan-07 9:52 
QuestionColumn ID in a Table wiht autoincrement value predetermined Pin
javierarka26-Jan-07 9:23
javierarka26-Jan-07 9:23 
AnswerRe: Column ID in a Table wiht autoincrement value predetermined Pin
andyharman26-Jan-07 9:50
professionalandyharman26-Jan-07 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.