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

Dynamic Dataset?

Status
Not open for further replies.

Qmoto

MIS
Joined
Oct 21, 2004
Messages
74
Location
US
I am having problems with a dataset that calls an SQL 2000 stored procedure.

Each time the page loads, a record is inserted, then when I hit the submit button a second record is inserted. Is there a way I can specify that a dataset is to load only if a certain condition is true? e.g. the form has been submitted

Here's what I've tried, but with no success. Am I close, or shoudl I scrap this and find a better method?

Code:
<MM:If runat="server" Expression='<%# If((Request.Form("submit") = "") then Response.Redirect("change.sec.adm2.aspx") %>'>
	<ContentsTemplate>
		<MM:DataSet
		runat="Server"
		id="sg_supportRequestInsert"
		IsStoredProcedure="true"
		CreateDataSet="false"
		ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_Intranet_DB") %>'
		DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_Intranet_DB") %>'
		CommandText="dbo.sg_supportRequest_insert"
		Debug="true">
	  <Parameters>
	  <Parameter  Name="@req_type_id"  Value='<%# IIf((Request.Form("req_type_id") <> Nothing), Request.Form("req_type_id"), "") %>'  Type="VarChar"   Direction="Input" />  
	  <Parameter  Name="@dep_nameShort_id"  Value='<%# IIf((Request.QueryString("dep") <> Nothing), Request.QueryString("dep"), "") %>'  Type="VarChar"   Direction="Input" />  
	  <Parameter  Name="@submittedBy"  Value='<%# IIf((Not Session("AUTH_USER") Is Nothing), Session("AUTH_USER"), "BI\") %>'  Type="VarChar"   Direction="Input" />  
	  </Parameters>
		</MM:DataSet>
	</ContentsTemplate>
</MM:If>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top