- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
注册页面提交数至数据库
ADO.NET数据库编程基础
实验目的
熟悉.NET平台的数据库访问组件ADO.NET。
掌握Microsoft SQL Server Express数据库的使用。
掌握在ASP.NET 平台上使用ADO.NET的方法。
实验内容1:
在11周所做的注册页面基础上,实现将用户提交的信息存储到数据库中。
创建项目
继续11周中所创建的项目;或新建一个Web网站,命名为“week12”。
创建数据库
1.右击项目,选择【添加】 【添加ASP.NET文件夹】 【App_Data】,结果如下:
2.然后,右击“App_Data”文件夹图标,选择【添加】 【新建项】,选中【SQL Server数据库】,给数据文件命名为“MyDB.mdf”,点击【添加】按钮。
结果如下:
3.双击“MyDB.mdf文件”,在左边的“服务器资源管理器”中,就会显示该数据库的各种对象。
4.在“表”节点,右击,选择【添加新表】
5.然后创建如下数据表(数据表名为“User”):
6.保存,数据库创建完毕。
7.添加一两个数据 选择表【User】 按右键选择【显示表数据】
编写页面功能
打开11周所做的注册页面(如果是新创建项目,就将注册页面复制到该项目中),在【提交注册】按钮事件的代码中,实现将信息存储到数据库中的功能。
其实现代码参考如下:
其中,连接字符串属性值为:
@Data Source .\SQLEXPRESS;AttachDbFilename |DataDirectory|\MyDB.mdf;Integrated Security True;User Instance True
命令文本值(即要执行的SQL命令)的值为:
string Sql insert into [User] name,password,sex,age values + TextBox1.Text.Trim + , + TextBox2.Text.Trim + , + TextBox3.Text.Trim + , + TextBox4.Text.Trim + ;
实验思考
实验中只是实现了数据的插入操作,那么,如果要执行,数据选择?数据删除?数据更新?该如实现?
在ASP.NET平台中,除了使用这种方式(直接使用ADO.NET基本对象)之外,还有没有其他操作数据库的方法?(提示:可使用数据源控件)
enforced thermal insulation starts checking system, issued by the thermal insulation construction before you start to notice, transfer inspection of upper and lower operation and transfer of records. For outdoor operation, pipeline equipment to effectively carry out the insulation waterproof measures fail to install protective panels in part with three tarpaulin cover, to prevent insulation from moisture. Insulation seam Michael Jackson 5mm, joints, joints 100mm, insulation thickness tolerance +10MM~ – 5mm , appropriate material elastic banding, spacing according to the design requirements, rigid insulation soft materials for construction joints tight; And large-diameter vertical pipe for high temperature pipeline in strict accordance with design drawings called for the establishment of expansion joints and holding bracket; Design requirements into a removable type of insulation, in strict accordance with specifications disconnect from the other insulation; Surface insulation b
您可能关注的文档
- 注会学习资料-PA《税法》讲义_003_0102_j.doc
- 注会学习资料-PA《税法》讲义_008_0203_j.doc
- 注会学习资料-PA《税法》讲义_009_0204_j.doc
- 注会学习资料-PA《税法》讲义_010_0205_j.doc
- 注会学习资料-PA《税法》讲义_011_0206_j.doc
- 注会学习资料-PA《税法》讲义_013_0208_j.doc
- 注会学习资料-PA《税法》讲义_015_0210_j.doc
- 注会学习资料-PA《税法》讲义_017_0212_j.doc
- 注会学习资料-PA《税法》讲义_019_0214_j.doc
- 注会学习资料-PA《税法》讲义_020_0215_j.doc
- 中国国家标准 GB/T 18233.4-2024信息技术 用户建筑群通用布缆 第4部分:住宅.pdf
- GB/T 18233.4-2024信息技术 用户建筑群通用布缆 第4部分:住宅.pdf
- GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计.pdf
- 《GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计》.pdf
- 中国国家标准 GB/T 18978.210-2024人-系统交互工效学 第210部分:以人为中心的交互系统设计.pdf
- GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置.pdf
- 《GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置》.pdf
- 中国国家标准 GB/T 16649.2-2024识别卡 集成电路卡 第2部分:带触点的卡 触点的尺寸和位置.pdf
- GB/T 17889.4-2024梯子 第4部分:铰链梯.pdf
- 《GB/T 17889.4-2024梯子 第4部分:铰链梯》.pdf
文档评论(0)