Xml file to SqlSelect Statement - best practice help

Hi all,

I am making a little reporting asp.net project and i need a bit of help.
I have xml files structured like this

<report>
<param name="startDate" type"SqlDbType.DateTime" />
<param name="company" type"SqlDbType.Text">
<item>Xyz Inc.</item>
<item>abc inc.</item>
</param>
<sql>
Sql here
</sql>
</report>

I have a class called Report that holds all the report's information once the XML has been loaded. I just need some help storing the parameters. Could i use something similar to SqlParameterCollection to convert and hold the XML Parameters (they need to be sql parameters before the query executes anyways) or should i store them as strings, or should i make a Class file for parameters and store them there.

Any help appreciated m

mcm




Answer this question

Xml file to SqlSelect Statement - best practice help

  • Gops Dwarak

    Whether or not to create a Class file for the parameters depends on your requirements. However, the most straight forward way to approach this is to:

    1. Create a SqlCommand
    2. Add the SqlParameters


  • Xml file to SqlSelect Statement - best practice help