﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Retrieve parameter names from stored procedures</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 10:40:59 GMT</lastBuildDate><ttl>20</ttl><item><title>Retrieve parameter names from stored procedures</title><link>http://forum.strataframe.net/FindPost11656.aspx</link><description>I have some old code where I used the &lt;FONT size=2&gt;System.Data.SqlClient.SqlConnection object that is dropped onto a form for data access.&amp;nbsp;&amp;nbsp; I use the connection object to retrieve parameter names of stored procedures.&amp;nbsp; I would like to convert it to use Strataframe.&amp;nbsp; Here is an example of what the code looks like now:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT size=2&gt;&lt;P&gt;cmd = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; SqlClient.SqlCommand(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"StoredProcedureName"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.SQLConnection99)&lt;/P&gt;&lt;P&gt;cmd.CommandType = CommandType.StoredProcedure&lt;/P&gt;&lt;P&gt;cmd.CommandTimeout = 60&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'get the parameters for the stored procedure&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;SqlCommandBuilder.DeriveParameters(cmd)&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;For&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Each&lt;/FONT&gt;&lt;FONT size=2&gt; prm &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; SqlParameter &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;In&lt;/FONT&gt;&lt;FONT size=2&gt; cmd.Parameters&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; prm.ParameterName &amp;lt;&amp;gt; &lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"RETURN_VALUE"&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;prm.Value = datarow(prm.ParameterName)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Next&lt;/FONT&gt;&lt;FONT size=2&gt; prm&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;How can I&amp;nbsp;use Strataframe's connection layer to eliminate the SQL connection object (SQLConnection99) I am using now to retrieve the parameter names?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sure it's simple, but I'm not seeing it. &lt;IMG title=Crazy src="http://forum.strataframe.net/Skins/Classic/Images/MessageIcons/Crazy.gif" align=absMiddle&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; As&amp;nbsp;always, thanks for your&amp;nbsp;expert help!&amp;nbsp;</description><pubDate>Wed, 26 Sep 2007 09:11:04 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Retrieve parameter names from stored procedures</title><link>http://forum.strataframe.net/FindPost11700.aspx</link><description>You can also use it like this:&lt;/P&gt;&lt;P&gt;Dim conn As SqlConnection = DirectCast(DataBasics.DataSources("").CreateBlankDbConnection(), SqlConnection)&lt;/P&gt;&lt;P&gt;All that does internally is create a new SqlConnection object and set its connection string to the one used by the data source.</description><pubDate>Wed, 26 Sep 2007 09:11:04 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Retrieve parameter names from stored procedures</title><link>http://forum.strataframe.net/FindPost11674.aspx</link><description>Yup...you got it.&amp;nbsp; Sorry if I was not more clear.&amp;nbsp; I was answering questions last night with a migraine headache....so I am not surprised that my answer was a little "muddy" :)&amp;nbsp; But you got exactly what I was saying. :)</description><pubDate>Tue, 25 Sep 2007 09:25:54 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Retrieve parameter names from stored procedures</title><link>http://forum.strataframe.net/FindPost11673.aspx</link><description>Hi Trent,&lt;/P&gt;&lt;P&gt;Sorry about the earlier post.&amp;nbsp; Once I posted my response, it dawn on me what you&amp;nbsp; had said.&amp;nbsp; It was as simple as...&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;&lt;FONT size=2&gt; conn &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; SqlConnection(DataBasics.DataSources(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;""&lt;/FONT&gt;&lt;FONT size=2&gt;).ConnectionString)&lt;/P&gt;&lt;P&gt;conn.Open()&lt;/P&gt;&lt;P&gt;cmd = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; SqlClient.SqlCommand(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"stored procedure name"&lt;/FONT&gt;&lt;FONT size=2&gt;, conn)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Thanks for the help!&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Tue, 25 Sep 2007 08:16:59 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Retrieve parameter names from stored procedures</title><link>http://forum.strataframe.net/FindPost11672.aspx</link><description>Hi Trent,&lt;/P&gt;&lt;P&gt;I guess I need little more help.&amp;nbsp; I have used the DataBasics.DataSources many times to execute stored procedures and it works great.&amp;nbsp; In my case, I believe I need to get a SqlConnection object, so that I can execute the SqlCommandBuilder.DeriveParameters(cmd)&amp;nbsp; to retrieve the stored procedure's parameters.&amp;nbsp; &lt;/P&gt;&lt;P&gt;How do I get a valid SqlConnection object using the DataSources..ConnectionString information to be used in the following statement.&lt;/P&gt;&lt;P&gt;cmd = New SqlClient.SqlCommand("StoredProcedureName",&amp;nbsp; &amp;gt;&amp;gt; SqlConnection Object &amp;lt;&amp;lt; )&lt;/P&gt;&lt;P&gt;Thanks!</description><pubDate>Tue, 25 Sep 2007 08:01:08 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Retrieve parameter names from stored procedures</title><link>http://forum.strataframe.net/FindPost11662.aspx</link><description>All you have to do is retrieve the connection string through your already defined data sources.&amp;nbsp; We do not "keep-alive" the connections and they are re-created as needed.&amp;nbsp; So if you want to create a temp connection, just pull ther string from the data sources connection:&lt;P&gt;[codesnippet]MicroFour.StrataFrame.Data.Databasics.DataSources("MyKey").ConnectionString[/codesnippet]&lt;P&gt;In this case you would just create your SQlConnection variable for testing.&amp;nbsp; You can also exevute queries directly off of this as well:&lt;P&gt;[codesnippet]MicroFour.StrataFrame.Data.DataBasics.DataSources("").ExecuteNonQuery("My Statement")[/codesnippet]</description><pubDate>Mon, 24 Sep 2007 20:59:38 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>