Insert posted data in SQL Server Database
-
I am able to post the data from Excel to ASP.NET MVC web service. Here is My code for that: Sub SendData() Dim HttpReq As Object, url As String Set HttpReq = CreateObject("MSXML2.ServerXMLHTTP") url = "http://localhost:11121/Student/PostData/" HttpReq.Open "POST", url, False HttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" HttpReq.Send "Student=jsmith112" Debug.Print HttpReq.ResponseText End Sub Now, I Want to have a ControllerAction "Insert" That will Insert this posted data in SQLServer Database. What do I need to do to controller action for this?
-
Answer:
You need to add <AcceptVerbs(HttpVerbs.POST)> attribute if it's vs2008 or just <HttpPost()> for vs2010 to your controller method, so it receives the posted data. Please note that this is in C#, syntax is slightly different for VB.
user793468 at Stack Overflow Visit the source
Related Q & A:
- How to connect Sql Server Database from android app?Best solution by Stack Overflow
- What is the best practice for free space for a SQL server database drive?Best solution by Database Administrators
- How to restrict access to a sql server database from Azure?Best solution by Stack Overflow
- How to import XML into SQL Server database?Best solution by Stack Overflow
- How do I connect to a SQL Server database?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.