i have a webservice that has a function which runs a proc. for some reason tho
which passes the xml string of parameters to this functionCode:substrEmail.Append("<ROOT>") For loopindex = 0 To groupsToEmail.Count - 1 substrEmail.Append("<group groupname=""" & groupsToEmail(loopindex) & """/>") Next 'close the root node substrEmail.Append("</ROOT>") 'get the users belonging to the groups Dim reader As SqlDataReader Dim dbs As New OI.Data.OIDB(ConString) reader = dbs.GetExternalUsersToEmail(substrEmail.ToString())
which calls RunProcedureCode:Public Function GetExternalUsersToEmail(ByVal groupXML As String) As SqlDataReader 'function gets groups to email Dim reader As SqlDataReader Dim parameters As SqlParameter() = { _ New SqlParameter("@group", SqlDbType.VarChar, 1000)} parameters(0).Value = groupXML reader = RunProcedure("sp_GetExternalUsersfromGroups", parameters) Return reader End Function
The ws throws a 500 error on the commandexecute reader errorCode:Protected Overloads Function RunProcedure( _ ByVal storedProcName As String, _ ByVal parameters As IDataParameter()) _ As SqlDataReader Dim returnReader As SqlDataReader Connection.Open() Dim command As SqlCommand = _ BuildQueryCommand(storedProcName, parameters) command.CommandType = CommandType.StoredProcedure 'errors here on the executereader (i think) returnReader = command.ExecuteReader( _ CommandBehavior.CloseConnection) 'connection will be closed automatically Return returnReader End Function
I don't know whats going on with it (obviously a 500 error isn't very descriptive) i'm wondering whether it is in any way related to the fact that i am passing a string of xml?
any help would be appreciated
the proc works, i can exec it from query analyser, so that shouldn't be a problem
here is the proc code
Code:CREATE PROC sp_GetExternalUsersfromGroups ( @groups varchar(1000) ) AS BEGIN SET NOCOUNT ON DECLARE @DocHandle int EXEC sp_xml_preparedocument @DocHandle OUTPUT, @groups SELECT username, emailaddress FROM tbl_externalusers as e inner join tbl_group as g on e.groupid = g.groupid inner join OPENXML (@DocHandle, '/ROOT/group',1) WITH (groupname varchar(1000)) AS x ON g.groupname = x.groupname EXEC sp_xml_removedocument @DocHandle END GO




Reply With Quote