Can you help? I have a ASP.NET question?
Question by ~*♥*~Ashley Star~*♥*~: Can you help? I have a ASP.NET question?
Im in the process of creating a website to allow users to submit their software update requests. However it has been about a year and a half since I’ve worked with ASP.NET so I am kinda drawing a blank. I am wanting to have a web form where users can fill out information and hit “Add request” button. When they do this I would like the information from the text boxes to be inserted into the user request database. Am I needing to user stored procedures or what? Just keep in mind this will be an on going website so fixing it up for “easy maintenance ” would help. Thank you!!
Using C# and MS Server 2003
Already have tables/database created
i’ve looked on google/read books 🙁 i just need a push in the right direction
Answer by kryzchek79
You could use a Stored Procedure, or you could use simple inline SQL. Either will accomplish the same goal.
In your Page_Load event handler, check for the postback. If postback == true, the user is submitting the form. Call a method that will handle saving your data.
This method will instance an SqlConnection and SqlCommand object to create a connection to your database and the inline SQL query.
Create parameters for your query using the values from your text boxes. Execute the query, close and dispose of your connection, and display a message to the user informing them the data was saved successfully.
Give your answer to this question below!
Leave a Reply