经典ASP按钮事件 [英] Classic ASP Button event

查看:75
本文介绍了经典ASP按钮事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我正在创建一个经典的ASP页面.现在,我想使用此asp页将数据插入数据库.我想在按钮单击事件中调用将数据插入数据库(SQL)的函数.

我不知道该怎么办.

谢谢,



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,

推荐答案

在ASP中没有这样的按钮单击事件".您需要做的是创建一个带有提交"类型按钮的HTML表单,该按钮会将表单的内容发布到ASP脚本中.

例如

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.

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



然后,创建您的ASP处理程序(在上面的示例中,"UpdateOrder"以检索表单的值并更新数据库.请查看此意大利面,以查看可能类似于以下内容的示例

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

除非您绝对没有其他选择,否则我强烈建议您使用ASP.Net或更好的"MVC .Net".我对ASP充满了痛苦的回忆,相比之下,在MVC中工作绝对是一件乐事!



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!


这篇关于经典ASP按钮事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆