Forums
This topic is locked
updating multiple tables with a single form
17 Nov 2007 18:36:26 mike west posted:
Hi all. I'm about at my wits end with this. I need to update 2 tables with one form. I've looked all over for how to do this and i keep hearing that i need to do two inserts on one form to get this to happen. The problem when I do this is that one table gets the record and the 2nd table gets nothing. I'm including my code here in hopes that someone can tell me what I am missing.<MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert
runat="server"
CommandText='<%# "INSERT INTO dbo.PendingCore (School, ID, LastName, FirstName, GradeLevel, Gender, Ethnicity, Birthdate, StNum, StName, POBox, City, Zip, Phone) VALUES (@School, @ID, @LastName, @FirstName, @GradeLevel, @Gender, @Ethnicity, @Birthdate, @StNum, @StName, @POBox, @City, @Zip, @Phone)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_test"

DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_test"

Expression='<%# Request.Form("MM_insert"

CreateDataSet="false"
SuccessURL='<%# "addstudent.aspx" %>'
Debug="true"
><Parameters>
<Parameter Name="@School" Value='<%# IIf((Request.Form("schoolattending"



<Parameter Name="@ID" Value='<%# IIf((Request.Form("StudentID"



<Parameter Name="@LastName" Value='<%# IIf((Request.Form("LastName"



<Parameter Name="@FirstName" Value='<%# IIf((Request.Form("FirstName"



<Parameter Name="@GradeLevel" Value='<%# IIf((Request.Form("Grade"



<Parameter Name="@Gender" Value='<%# IIf((Request.Form("Gender"



<Parameter Name="@Ethnicity" Value='<%# IIf((Request.Form("Ethnicity"



<Parameter Name="@Birthdate" Value='<%# IIf((Request.Form("DateOfBirth"



<Parameter Name="@StNum" Value='<%# IIf((Request.Form("StNum"



<Parameter Name="@StName" Value='<%# IIf((Request.Form("StName"



<Parameter Name="@POBox" Value='<%# IIf((Request.Form("POBox"



<Parameter Name="@City" Value='<%# IIf((Request.Form("City"



<Parameter Name="@Zip" Value='<%# IIf((Request.Form("Zip"



<Parameter Name="@Phone" Value='<%# IIf((Request.Form("phone"



</Parameters>
</MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert>
<MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert
runat="server"
CommandText='<%# "INSERT INTO dbo.PendingDemo2 (School, ID, ParentName, BusinessPhone) VALUES (@School, @ID, @ParentName, @BusinessPhone)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_test"

DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_test"

Expression='<%# Request.Form("MM_insert"

CreateDataSet="false"
Debug="true"
><Parameters>
<Parameter Name="@School" Value='<%# IIf((Request.Form("schoolattending"



<Parameter Name="@ID" Value='<%# IIf((Request.Form("StudentID"



<Parameter Name="@ParentName" Value='<%# IIf((Request.Form("ParentName"



<Parameter Name="@BusinessPhone" Value='<%# IIf((Request.Form("BusinessPhone"



</Parameters>
</MM<img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>nsert>