Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to add fields from a form to a database using the tableadapter in vi

ID: 3778049 • Letter: I

Question

I am trying to add fields from a form to a database using the tableadapter in visual studio in c#. I am not getting any of it to work and it is giving me errors for the 2 fields that are not strings. I need the user to be able to input data into the fields and then that to show up on the database. Here is what I have:

Here is the SQL I am using that was given by visual studio:

INSERT INTO [dbo].[Tickets] ([Name], [Phone], [Email], [Location], [Date], [Priority], [Description])

VALUES (@Name, @Phone, @Email, @Location, @Date, @Priority, @Description);

SELECT Id, Name, Phone, Email, Location, Date, Priority, Description FROM Tickets WHERE (Id = SCOPE_IDENTITY())

Maybe I need to change the sql?

Can you please help me fix this?

Name Phone Email Location Date Priority: Description Sunday November 27, 2016 Submit

Explanation / Answer

As per code you have shared in the screenshot, the values are not assigned to both phone and priority from form like for all other fields. Try initializing both like textPhone.value etc to these two variables.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote