none
Data connection returns columns in different order from Stored procedure RRS feed

  • Question

  • Hello All,

    Am currently facing a issue with data connection.  It uses data connection and being refreshed by vba.

    Qry = "EXECUTE dbo.Pro_SP @Trxdate = '" & Sheet1.Range("B2").Value & "'"
        With ActiveWorkbook.Connections(1).ODBCConnection
            .CommandText = Qry
            .Refresh        
        End With

    The stored procedure uses and runs the below query
    select a,b,c,d,e from Table 

    But in excel the columns are returned as below
    a,b,c,e,d

    Any idea why columns are returned and placed in different order? Please clarify

    Thanks,
    Arun
    Friday, January 9, 2015 1:20 PM