Problemi su Dataset, stored procedure ed XML

T

Telemaco

Ho la necessità di inserire i risultati di una stored procedure in un
dataset.
Mi spiego meglio ....
Ho costruito una store procedure che incapsula una query di lettura su un
database sqlserver che restituisce di dati in formato xml.
La clausola utilizzata per avere il risultato in xml è: FOR XML
AUTO,XMLDATA, e la stored procedure si chiama SP_Lettura ed accetta tre
parametri interi P1,P2,P3.

....
DataSet ds=new DataSet();
ds.ReadXml(forXMLCommand.ExecuteXmlReader(),XmlReadMode.Fragment); <-
....

Quando eseguo la linea segnata ottengo il seguente errore:
Line 1: Incorrect syntax near 'sp_Lettura'

Se invece di utilizzare una stored procedure utilizzo una query il problemma
non esiste.

Accetto consigli su come caricare i risultati xml di una sotred procedure in
un dataset.
Grazie anticipatamente per la risposta
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

Could you post the code creating the forXMLCommand instance? At least you
might want to check whether the CommandType is set to 'Stored Procedure'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top