Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Select 1

Status
Not open for further replies.

ClulessChris

IS-IT--Management
Jan 27, 2003
890
GB
in the same way that with an Update query the command is sent to the server and the server processes the query. i.e DB.Execute "Update Query"

Is it posible to send the comand for a SELECT query, have the server process the query, and return a string (not a recordset.

I'm looking for a method to get data via LDAP with out pull a recordset.

Is this possible?

Everybody is somebodys Nutter.
 




Hi,

I write user defined functions that query and return a string.

Example...
Code:
Function GetNomen(sPN As String) As String
'SkipVought/2006 Mar 7/817-280-5438
'--------------------------------------------------
' Access: DWPROD.FRH_MRP.READ
'--------------------------------------------------
'this function returns nomenclature for a given part number
'--------------------------------------------------
    Dim sConn As String, sSQL As String, sServer As String
    Dim rst As ADODB.Recordset, cnn As ADODB.Connection
    
    Set cnn = New ADODB.Connection
    
    sServer = "dwprod"
    cnn.Open "Driver={Microsoft ODBC for Oracle};" & _
               "Server=" & sServer & ";" & _
               "Uid=/;" & _
               "Pwd="
    
    Set rst = New ADODB.Recordset
    
    sSQL = "SELECT PM.Nomen_201 "
    sSQL = sSQL & "FROM FRH_MRP.PSK02101 PM "
    sSQL = sSQL & "WHERE PM.PARTNO_201 like '" & Trim(sPN) & "%' "
    
'    Sheets("sysParms").Range("SQL_Code").Value = sSQL
        
    rst.Open sSQL, cnn, adOpenStatic, adLockReadOnly, adCmdText
                          
    rst.MoveFirst
    GetNomen = rst("NOMEN_201")

    rst.Close
    cnn.Close
    
    Set rst = Nothing
    Set cnn = Nothing
End Function


Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
Skip,

Thanks for the input. This is much the same as I would code, however this pulls a recordset from server to client. I'm hope find if its posible to have the server run the query and return the results (idealy in a CSV format) without a recordset.
I suspect that this is not posible. but thought to investigate.

Everybody is somebodys Nutter.
 




I believe that it depends on the database you are using.

If you execute a server side function as opposed to a client side function, you'll just get the return value conming across the network.

Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top