Sign-up....

考试的题目,求最佳解答

访问purchase.htm网页后,用户录入信息后,通过递交,调用insert.asp,完成将新书插入数据库books表中操作,并返回提示“操作完成”到用户浏览器,试编写insert.asp网页代码。

数据库表截图:

http://img105.photo.163.com/zill55/11653894/260531229.jpg

<html>

<body>

<form method="POST" action="insert.asp">

书号:<input type="text" name="txtbookID">

出版社:<input type="text" name="txtpublish" size="40">

书名:<input type="text" name="txtname" size="40">

定价:<input type="text" name="txtprice">

<input type="submit" value="新增记录" >

</form>

</body>

</html>

提示:一些数据库组件操作命令格式:

1.创建ADO对象:Set newconn=Server.CreateObject("ADODB.Connection")

newconn.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\publish.mdb”

2.创建记录对象:Set rs= Server.CreateObject("ADODB.RecordSet")

3.打开数据表:newconn.Open “books”

4.创建添加新记录SQL语句:SQLcmd="INSERT INTO books(书号,出版社,书名,定价) Values(‘”&txtbookID & “’, ‘” & txtpublish & “’, ‘” & txtname & “’, ‘” & txtprice & “’)”

5.Set rs=newconn.Execute(SQLcmd)

6.关闭记录对象:rs.Close

7.关闭ADO对象:newconn.Close

[933 byte] By [msdn] at [2007-8-15 1:26:32]
# 1 Re: 考试的题目,求最佳解答

晕了,,答案他都给你了还考什么???

request把参数接过来

插入给了你了

执行完插入

reponse.write "<javascrpt language='javascript'>alert('写入成功');windows.close</script>"

就ok了.

kyxlzj at 2005-7-2 17:12:49 >
# 2 Re: 考试的题目,求最佳解答

蔡鸟求完整的代码,为了应付考试

zill55 at 2005-7-2 17:22:57 >
# 3 Re: 考试的题目,求最佳解答

帮自己顶一下

zill55 at 2005-7-2 20:49:43 >
# 4 Re: 考试的题目,求最佳解答

呵呵,这也叫考试。。。

doveph at 2005-7-2 23:35:22 >
# 5 Re: 考试的题目,求最佳解答

写程序也偷懒……^o^

crazyhit at 2005-7-3 5:43:31 >
# 6 Re: 考试的题目,求最佳解答

感谢 shrinerain(圣影雨) !!

zill55 at 2005-7-3 11:14:36 >
# 7 Re: 考试的题目,求最佳解答

小鬼,你走错地方了!!

superdullwolf at 2005-7-3 11:30:09 >
# 8 Re: 考试的题目,求最佳解答

这样的考试都通不过?

wfront at 2005-7-3 11:39:51 >
# 9 Re: 考试的题目,求最佳解答

那我应该去哪里?

zill55 at 2005-7-4 22:36:19 >
# 10 Re: 考试的题目,求最佳解答

汗...

rocket11 at 2005-7-5 9:36:29 >
# 11 Re: 考试的题目,求最佳解答

这样的考试这么简单?

都给答案了

wxcyz at 2005-7-5 10:10:58 >
# 12 Re: 考试的题目,求最佳解答

一点都不简单啊!你们说说,学文秘专业的,居然让我们学编程,多痛苦呀~

zill55 at 2005-7-5 11:09:41 >

Web

All Classified