Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,

I'm create a classic asp page. Now I want to insert data to the database using this asp page. I want to call a function to insert data to the database(SQL) in the button click event.

I dont know how to do it.

Thanks,
Posted

1 solution

There's no 'button click event' as such in ASP. What you need to do is create an HTML form with a 'submit' type button that will post the content of the form to an ASP script.

e.g.

HTML
<form id="UserLoginForm" method="post" action="UpdateOrder.asp">


Then, create your ASP handler (in the above example, 'UpdateOrder' to retrieve the values of the form and update the database. Have a look at this spaghetti for an example of what that could look like

http://stackoverflow.com/questions/7880908/asp-update-database-insert-if-does-not-exist[^]

Unless you absolutely have no other option, I strongly suggest using ASP.Net or even better, 'MVC .Net'. I have painful memories of ASP, working in MVC is an absolute pleasure in comparison!
 
Share this answer
 
Comments
Pandvi 30-May-12 4:11am    
Good work! my 5!
Soft009 30-May-12 4:25am    
Thank you, I'll try it..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900