Click here to Skip to main content
15,917,320 members
Home / Discussions / Database
   

Database

 
AnswerRe: Connecting to remote SQL Express Pin
steve_rm29-Jan-07 6:05
steve_rm29-Jan-07 6:05 
QuestionHow do I change the date format? Pin
davidstern10028-Jan-07 5:01
davidstern10028-Jan-07 5:01 
AnswerRe: How do I change the date format? Pin
Colin Angus Mackay28-Jan-07 5:37
Colin Angus Mackay28-Jan-07 5:37 
QuestionHow do i compare Datetime Pin
www.Developerof.NET28-Jan-07 0:33
www.Developerof.NET28-Jan-07 0:33 
AnswerRe: How do i compare Datetime Pin
Bassam Saoud28-Jan-07 2:04
Bassam Saoud28-Jan-07 2:04 
GeneralRe: How do i compare Datetime Pin
www.Developerof.NET28-Jan-07 6:56
www.Developerof.NET28-Jan-07 6:56 
QuestionConnectivity issue - SQLServer not listening on port 1433/ms-sql-s Pin
viji]27-Jan-07 22:23
viji]27-Jan-07 22:23 
Questioncannot connect to server Pin
rp_suman27-Jan-07 20:51
rp_suman27-Jan-07 20:51 
AnswerRe: cannot connect to server [modified] Pin
Aaron VanWieren28-Jan-07 9:23
Aaron VanWieren28-Jan-07 9:23 
GeneralRe: cannot connect to server Pin
rp_suman2-Feb-07 4:16
rp_suman2-Feb-07 4:16 
QuestionCrystal Report vb.net 2005 !!! Pin
kindman_nb27-Jan-07 19:08
kindman_nb27-Jan-07 19:08 
AnswerRe: Crystal Report vb.net 2005 !!! Pin
Bassam Saoud27-Jan-07 21:59
Bassam Saoud27-Jan-07 21:59 
GeneralRe: Crystal Report vb.net 2005 !!! Pin
kindman_nb27-Jan-07 22:05
kindman_nb27-Jan-07 22:05 
GeneralRe: Crystal Report vb.net 2005 !!! Pin
kindman_nb28-Jan-07 5:10
kindman_nb28-Jan-07 5:10 
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 

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.