XModPro

Stored Output Parameter Help Needed

Steve Steve asked Feb 10, 2014
Active Feb 10 · Viewed 1600 times
<p>I am trying to build a master-detail setup for conference registration.</p><p>Page1 is the company information</p><p>Page2 is the participant information.</p><p>One company can have many participants being registered. The tables are tied together with RegID - the primary key identity value in the master table and the foreign key in the detail table.</p><p>The stored procedure itself seems to work OK - the data input into the form on Page1 DOES get inserted into the master table.</p><p>However, it won't redirect to Page2. After the form on Page1 is submitted, it stays on that form with an error message that says " <p>Error converting data type int to nvarchar"</p><p>I have spent hours trying to fix this to no avail. Please help.</p><p>SP:</p><p>SET ANSI_NULLS ON</p><p>GO</p><p>SET QUOTED_IDENTIFIER ON</p><p>GO</p><p>--&nbsp;</p><p>CREATE PROCEDURE [dbo].[ssInsertCompany2]</p><p>@CompanyName varchar(100),</p><p>@Address varchar(50),</p><p>@City varchar(50),</p><p>@State varchar(50),</p><p>@Zip varchar(50),</p><p>@Website varchar(50),</p><p>@NewRegID int OUTPUT</p><p>AS</p><p>BEGIN</p><p>SET NOCOUNT ON;</p><p>INSERT INTO [tblRegistration2] ([CompanyName], [Address], [City], [State], [Zip], [Website]) VALUES(@CompanyName, @Address, @City, @State, @Zip, @Website);</p><p>set @NewRegID=SCOPE_IDENTITY();</p><p>END</p><p>NOTE: I also tried SELECT instead of SET on the SCOPE IDENTITY LINE</p><p>Form Code:</p><p> &lt;SubmitCommand CommandText="dbo.ssInsertCompany2" CommandType="StoredProcedure" ConnectionString="Data Source=U15343166;Initial Catalog=Registrations;User ID=ConfReg;Password=RegConf1700"&gt; &lt;Parameter Name="CompanyName" DataType="string"/&gt;&lt;Parameter Name="Address" DataType="string"/&gt;&lt;Parameter Name="City" DataType="string"/&gt;&lt;Parameter Name="State" DataType="string"/&gt;&lt;Parameter Name="Zip" DataType="string"/&gt;&lt;Parameter Name="Website" DataType="string"/&gt;&lt;Parameter Name="NewRegID" Direction="Output" DataType="Int64"/&gt;</p><p> &lt;/SubmitCommand&gt;</p><p> &lt;div&gt;</p><p> &lt;div&gt;&lt;Label CssClass="xmp-form-label NormalBold" For="CompanyName"&gt;Company Name&lt;/Label&gt;&lt;TextBox Id="CompanyName" Width="300" Nullable="true" MaxLength="100" DataField="CompanyName" DataType="string"&gt;&lt;/TextBox&gt;&lt;/div&gt;</p><p> &lt;div&gt;&lt;Label CssClass="xmp-form-label NormalBold" For="Address"&gt;Address&lt;/Label&gt;&lt;TextBox Id="Address" Width="250" Nullable="true" MaxLength="50" DataField="Address" DataType="string"&gt;&lt;/TextBox&gt;&lt;/div&gt;</p><p> &lt;div&gt;&lt;Label CssClass="xmp-form-label NormalBold" For="City"&gt;City&lt;/Label&gt;&lt;TextBox Id="City" Width="200" Nullable="True" MaxLength="50" DataField="City" DataType="string"&gt;&lt;/TextBox&gt;&lt;/div&gt;</p><p> &lt;div&gt;&lt;Label CssClass="xmp-form-label NormalBold" For="State"&gt;State&lt;/Label&gt;&lt;TextBox Id="State" Width="75" Nullable="true" MaxLength="50" DataField="State" DataType="string"&gt;&lt;/TextBox&gt;&lt;/div&gt;</p><p> &lt;div&gt;&lt;Label CssClass="xmp-form-label NormalBold" For="Zip"&gt;Zip&lt;/Label&gt;&lt;TextBox Id="Zip" Width="100" Nullable="true" MaxLength="50" DataField="Zip" DataType="string"&gt;&lt;/TextBox&gt;&lt;/div&gt;</p><p> &lt;div&gt;&lt;Label CssClass="xmp-form-label NormalBold" For="Website"&gt;Website&lt;/Label&gt;&lt;TextBox Id="Website" Width="225" Nullable="true" MaxLength="50" DataField="Website" DataType="string"&gt;&lt;/TextBox&gt;&lt;/div&gt;</p><p> &lt;div&gt;&lt;Label&gt;&nbsp;&lt;/Label&gt;</p><p> &lt;p&gt;&nbsp;&lt;/p&gt;</p><p> &lt;CancelButton Text="Cancel" Visible="true"&gt;&lt;/CancelButton&gt;&lt;AddButton Text="Add Participants" style="margin-left: 12px;" Redirect="/Maintenance/Comps2EE.aspx <p>?NewRegID=[[NewRegID]]"</p><p>RedirectMethod="Get"&gt;&lt;/AddButton&gt;&lt;/div&gt;</p><p> &lt;/div&gt;</p><p>&lt;/AddForm&gt;</p><p>NOTE: I used int32 for a while...thought I would try the 64. Doesn't matter...same error message</p><p>Thank you</p></p>

1 Answer

Loading answers...