Click here to Skip to main content
15,889,315 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Using Functions across forms Pin
Peter Leow1-Jun-14 17:12
professionalPeter Leow1-Jun-14 17:12 
GeneralRe: Using Functions across forms Pin
gwittlock1-Jun-14 18:14
gwittlock1-Jun-14 18:14 
AnswerRe: Using Functions across forms Pin
Bernhard Hiller2-Jun-14 0:23
Bernhard Hiller2-Jun-14 0:23 
GeneralRe: Using Functions across forms Pin
gwittlock2-Jun-14 1:14
gwittlock2-Jun-14 1:14 
Questionlistview won't display data populated in vb6 Pin
Dave-1016953130-May-14 6:37
professionalDave-1016953130-May-14 6:37 
AnswerRe: listview won't display data populated in vb6 Pin
Tim Carmichael30-May-14 9:02
Tim Carmichael30-May-14 9:02 
GeneralRe: listview won't display data populated in vb6 Pin
Dave-1016953130-May-14 9:32
professionalDave-1016953130-May-14 9:32 
QuestionImport from SQL table by column Pin
Member 1066669830-May-14 4:38
Member 1066669830-May-14 4:38 
Hi everyone

I have the following to extract data from a SQL database and write it to an Excel table. I would likte to change the loop so that the data is copied to Excel per column rather than single field (to speed up th import):

'Create the connection string
sConnString = "Provider=SQLOLEDB.1;Data Source=SRV002982;" & _
              "Initial Catalog=HFMDSmartFDM_QMR211;" & _
              "Password=password;Persist Security Info=True;User ID=User"

'Create the Connection and Recordset objects
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")

'Open the connection and execute
conn.Open sConnString
Set rs = conn.Execute(CommandString)

    'Check data
    If Not rs.EOF Then
        nRow = nRow + 1
        'Transfer result to WS
        Do While Not rs.EOF
            For Each elem In rs.Fields
                nCol = nCol + 1
                ws.Cells(nRow, nCol) = elem
            Next
        rs.movenext
        Loop
    End If


There are reasons I can't just splash the entire table. I need to import column by column. Any help is greatly appreciated
AnswerRe: Import from SQL table by column Pin
Eddy Vluggen30-May-14 10:43
professionalEddy Vluggen30-May-14 10:43 
AnswerRe: Import from SQL table by column Pin
Mycroft Holmes30-May-14 13:01
professionalMycroft Holmes30-May-14 13:01 
GeneralRe: Import from SQL table by column Pin
Member 106666981-Jun-14 22:40
Member 106666981-Jun-14 22:40 
GeneralRe: Import from SQL table by column Pin
Member 106666981-Jun-14 22:59
Member 106666981-Jun-14 22:59 
GeneralRe: Import from SQL table by column Pin
Mycroft Holmes2-Jun-14 0:53
professionalMycroft Holmes2-Jun-14 0:53 
GeneralRe: Import from SQL table by column Pin
Member 106666982-Jun-14 4:49
Member 106666982-Jun-14 4:49 
GeneralRe: Import from SQL table by column Pin
Eddy Vluggen2-Jun-14 8:23
professionalEddy Vluggen2-Jun-14 8:23 
GeneralRe: Import from SQL table by column Pin
Member 106666982-Jun-14 20:42
Member 106666982-Jun-14 20:42 
QuestionIIf Statement - Different Problem With RDLC Pin
Paramu197329-May-14 15:05
Paramu197329-May-14 15:05 
QuestionActivex code to print pdf files on client machine Pin
Sachin Mehndiratta29-May-14 2:55
Sachin Mehndiratta29-May-14 2:55 
QuestionClose a form at a specific moment Pin
dilkonika28-May-14 6:32
dilkonika28-May-14 6:32 
AnswerRe: Close a form at a specific moment Pin
Eddy Vluggen28-May-14 7:28
professionalEddy Vluggen28-May-14 7:28 
GeneralRe: Close a form at a specific moment Pin
dilkonika28-May-14 8:31
dilkonika28-May-14 8:31 
QuestionRe: Close a form at a specific moment Pin
Eddy Vluggen28-May-14 9:30
professionalEddy Vluggen28-May-14 9:30 
GeneralRe: Close a form at a specific moment Pin
Dave Kreskowiak28-May-14 13:33
mveDave Kreskowiak28-May-14 13:33 
GeneralRe: Close a form at a specific moment Pin
dilkonika29-May-14 6:14
dilkonika29-May-14 6:14 
GeneralRe: Close a form at a specific moment Pin
Dave Kreskowiak29-May-14 13:39
mveDave Kreskowiak29-May-14 13:39 

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.