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 SubmitExplanation / 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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.