I have the following code which is to get the data a user enters in a web form and insert it into the database.
when i enter data into every field on the form and run the insert() method I get the following errorCode:... <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:jordanvalleybrConnectionString %>"
InsertCommand="INSERT INTO Player_Info(Player_FName, Player_LName, Address, City, State, Zip,
Parent_FName, Parent_LName, Parent_Phone, Email, Emergency_FName,
Emergency_LName, Emergency_Phone, Doctor_Name, Doctor_Phone)
VALUES (@playerFirstName,@playerLastName,@address,@city,@state,@zip,@parentFirstName,@parentLastName,@parentPhone,
@email,@emergencyFirstName,@emergencyLastName,@emergencyPhone,@doctorName,@doctorPhone)"
SelectCommand="SELECT * FROM [Player_Info]">
<InsertParameters>
<asp:FormParameter Name="playerFirstName" FormField="playerFirstName" />
<asp:FormParameter Name="playerLastName" FormField="playerLastName" />
<asp:FormParameter Name="address" FormField="TBaddress" />
<asp:FormParameter Name="city" FormField="TBCity" />
<asp:FormParameter Name="state" FormField="TBstate" />
<asp:FormParameter Name="zip" FormField="TBZip" />
<asp:FormParameter Name="parentFirstName" FormField="TBparentFirstName" />
<asp:FormParameter Name="parentLastName" FormField="TBparentLastName" />
<asp:FormParameter Name="parentPhone" FormField="TBParentPhone" />
<asp:FormParameter Name="email" FormField="TBEmail2" />
<asp:FormParameter Name="emergencyFirstName" FormField="TBcontactFirstName" />
<asp:FormParameter Name="emergencyLastName" FormField="TBContactLastName" />
<asp:FormParameter Name="emergencyPhone" FormField="TBContactPhone" />
<asp:FormParameter Name="doctorName" FormField="TBDoctorName" />
<asp:FormParameter Name="doctorPhone" FormField="TBDoctorPhone" />
</InsertParameters>
</asp:SqlDataSource>
Cannot insert the value NULL into column 'Player_FName', table 'jordanvalleybr.dbo.Player_Info'; column does not allow nulls. INSERT fails.
The statement has been terminated.
i have verified the ID of the text boxes are correct and they are not null..
it just seems to not be getting the data from the text box of the form.
Can you see if I am doing something wrong in the above code?
Thanks
