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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getstring returning a stray Comma at end

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
SQL Server 2000.

I am obtaining a list of Referral Id's from a stored proc in one database sitting on ServerA and using the list as input to another proc on ServerB.

A recordset is returned successfully and I am using rs.getstring method with the appropriate syntax to return the recordset as a string.

The problem I have is the Getstring method is returning a stray comma and space ", " at the end of the string. This causes grief when the string is passed as inout to the second proc.

The relevant code is as follows:

Code:
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient
conn.Open Connstring
    
Dim cmd1 As ADODB.Command
Set cmd1 = New ADODB.Command
cmd1.ActiveConnection = conn
cmd1.CommandType = adCmdStoredProc
cmd1.Parameters.Refresh
     
cmd1.Parameters.Append cmd1.CreateParameter("@Type", _
        adInteger, adParamInput, , 1)
cmd1.Parameters.Append cmd1.CreateParameter("@Status", _
        adInteger, adParamOutput)
cmd1.CommandText = "IMRU_CAPAC_Treatment_Teams"
    
Set rs = New ADODB.Recordset
rs.Open cmd1        
Status = cmd1.Parameters("@Status").Value
    
' adClipString is a stringFormatEnum which forces use of
' delimiting characters. In this case,"," will seperate the
' rows

Dim SR_List As String
SR_List = rs.GetString(adClipString, , , ",")

Thanks

The risk with keeping an open mind is having your brains fall out.
Shaunk

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top