- 浏览: 11791197 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
笨蛋咯:
获取不到信息?
C#枚举硬件设备 -
guokaiwhu:
能把plan的数据结构图画出来,博主的耐心和细致令人佩服。
PostgreSQL服务过程中的那些事二:Pg服务进程处理简单查询五:规划成plantree -
gao807877817:
学习
BitmapFactory.Options详解 -
GB654:
楼主,我想问一下,如何在创建PPT时插入备注信息,虽然可以解析 ...
java转换ppt,ppt转成图片,获取备注,获取文本 -
jpsb:
多谢 ,不过我照搬你的sql查不到,去掉utl_raw.cas ...
关于oracle中clob字段查询的问题
数据库系统设计初步
C#2005实现的简单解题系统,数据库课程设计准备知识。实现数据绑定,记录定位,更新数据,查询数据等功能。其他功能可以在此基础上增加。
方便起见使用ACCESS建立数据库;建立两张表: questions(序号,内容),序号:自动编号 answers(id,学号,姓名,问题ID,答案,提交时间),id:自动编号,问题ID参照questions(序号)。
功能代码为
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace testIt { public partial class frmTest : Form { public frmTest() { InitializeComponent(); } private OleDbConnection cnn; private OleDbDataAdapter da; private DataSet ds; private OleDbCommand cmd; private BindingManagerBase bm; private OleDbCommandBuilder cb; private void bm_PositionChanged(object sender, EventArgs e) { txtPosition.Text = "Rec " + (bm.Position + 1) + " of " + bm.Count; } private void frmTest_Load(object sender, EventArgs e) { cnn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "d://test//tm.mdb"); cnn.Open(); da = new OleDbDataAdapter("select 序号,内容 from questions", cnn); ds = new DataSet(); da.Fill(ds, "questions"); OleDbDataAdapter daAnswer = new OleDbDataAdapter("select 问题ID from answers", cnn); daAnswer.Fill(ds, "answers"); cboContests.DataSource = ds.Tables["questions"]; cboContests.DisplayMember = "内容"; cboContests.ValueMember = "序号"; cboContests.DataBindings.Add("SelectedValue", ds, "answers.问题ID"); dgvContents.DataSource = ds; dgvContents.DataMember = "questions"; bm = this.BindingContext[ds,"questions"]; bm.CurrentChanged += new EventHandler(bm_PositionChanged); txtPosition.Text = "Rec " + (bm.Position + 1) + " of " + bm.Count; rtxtContents.DataBindings.Add(new Binding("text", ds, "questions.内容")); cmd = new OleDbCommand(); cmd.Connection = cnn; cb = new OleDbCommandBuilder(da); } private void btnNext_Click(object sender, EventArgs e) { bm.Position++; } private void btnLast_Click(object sender, EventArgs e) { bm.Position = bm.Count; } private void btnPrevious_Click(object sender, EventArgs e) { bm.Position--; } private void btnFirst_Click(object sender, EventArgs e) { bm.Position = 0; } private void btnCommit_Click(object sender, EventArgs e) { cmd.CommandType = CommandType.Text; OleDbCommand cmdTemp=new OleDbCommand("select 序号 from questions where 内容='" + rtxtContents.Text + "'",cnn); OleDbDataReader dr=cmdTemp.ExecuteReader(); dr.Read(); string id=dr.GetValue(0).ToString(); string strSql = "insert into answers(学号,姓名,问题ID,答案,提交时间) values('" + txtNo.Text + "','" + txtName.Text + "'," + id + ",'" + rtxtAnswer.Text + "','" + DateTime.Now + "')"; cmd.CommandText = strSql; int cnt=cmd.ExecuteNonQuery(); if (cnt > 0) { MessageBox.Show("提交成功!"); } } private void btnInsert_Click(object sender, EventArgs e) { bm.AddNew(); } private void btnSave_Click(object sender, EventArgs e) { bm.EndCurrentEdit(); da.Update(ds, "questions"); ds.AcceptChanges(); } private void btnDelete_Click(object sender, EventArgs e) { bm.RemoveAt(bm.Position); da.Update(ds, "questions"); } private void btnCancel_Click(object sender, EventArgs e) { bm.CancelCurrentEdit(); } private void btnLocate_Click(object sender, EventArgs e) { int i; for (i = 0; i < bm.Count; i++) { bm.Position = i; DataRowView curRow = (DataRowView)bm.Current; if (curRow["内容"].ToString() == txtInput.Text) break; } if (i >= bm.Count) MessageBox.Show("找不到!"); } } }
//连接MS Sql Server数据库,要修改连接串如下(test为数据库名,登录名与登录密码都是sa) 。 using System.Data.OleDb; OleDbConnection cnn = new OleDbConnection("Provider=SqlOledb.1;Server=(local);database=test;uid=sa;pwd=sa"); cnn.Open(); //或 using System.Data.SqlClient; SqlConnection cnn = new SqlConnection("Server=(local);database=test;uid=sa;pwd=sa"); cnn.Open();
//界面设计代码为
namespace testIt { partial class frmTest { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.txtNo = new System.Windows.Forms.TextBox(); this.txtName = new System.Windows.Forms.TextBox(); this.btnCommit = new System.Windows.Forms.Button(); this.lblContents = new System.Windows.Forms.Label(); this.dgvContents = new System.Windows.Forms.DataGridView(); this.rtxtContents = new System.Windows.Forms.RichTextBox(); this.btnNext = new System.Windows.Forms.Button(); this.btnLast = new System.Windows.Forms.Button(); this.btnPrevious = new System.Windows.Forms.Button(); this.btnFirst = new System.Windows.Forms.Button(); this.txtPosition = new System.Windows.Forms.TextBox(); this.rtxtAnswer = new System.Windows.Forms.RichTextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.btnDelete = new System.Windows.Forms.Button(); this.btnInsert = new System.Windows.Forms.Button(); this.btnLocate = new System.Windows.Forms.Button(); this.txtInput = new System.Windows.Forms.TextBox(); this.btnSave = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.cboContests = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.dgvContents)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(3, 24); this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(32, 16); this.label1.TabIndex = 0; this.label1.Text = "Sno"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(194, 24); this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(48, 16); this.label2.TabIndex = 1; this.label2.Text = "Sname"; // // txtNo // this.txtNo.Location = new System.Drawing.Point(40, 14); this.txtNo.Margin = new System.Windows.Forms.Padding(4); this.txtNo.MaxLength = 8; this.txtNo.Name = "txtNo"; this.txtNo.Size = new System.Drawing.Size(132, 26); this.txtNo.TabIndex = 2; // // txtName // this.txtName.Location = new System.Drawing.Point(242, 14); this.txtName.Margin = new System.Windows.Forms.Padding(4); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(132, 26); this.txtName.TabIndex = 3; // // btnCommit // this.btnCommit.Location = new System.Drawing.Point(394, 299); this.btnCommit.Name = "btnCommit"; this.btnCommit.Size = new System.Drawing.Size(75, 32); this.btnCommit.TabIndex = 4; this.btnCommit.Text = "Commit"; this.btnCommit.UseVisualStyleBackColor = true; this.btnCommit.Click += new System.EventHandler(this.btnCommit_Click); // // lblContents // this.lblContents.AutoSize = true; this.lblContents.Location = new System.Drawing.Point(96, 98); this.lblContents.Name = "lblContents"; this.lblContents.Size = new System.Drawing.Size(0, 16); this.lblContents.TabIndex = 6; // // dgvContents // this.dgvContents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvContents.Location = new System.Drawing.Point(394, 12); this.dgvContents.Name = "dgvContents"; this.dgvContents.RowTemplate.Height = 23; this.dgvContents.Size = new System.Drawing.Size(245, 254); this.dgvContents.TabIndex = 7; // // rtxtContents // this.rtxtContents.Location = new System.Drawing.Point(12, 77); this.rtxtContents.Name = "rtxtContents"; this.rtxtContents.Size = new System.Drawing.Size(171, 254); this.rtxtContents.TabIndex = 8; this.rtxtContents.Text = ""; // // btnNext // this.btnNext.Location = new System.Drawing.Point(216, 337); this.btnNext.Name = "btnNext"; this.btnNext.Size = new System.Drawing.Size(83, 32); this.btnNext.TabIndex = 10; this.btnNext.Text = "Next"; this.btnNext.UseVisualStyleBackColor = true; this.btnNext.Click += new System.EventHandler(this.btnNext_Click); // // btnLast // this.btnLast.Location = new System.Drawing.Point(305, 337); this.btnLast.Name = "btnLast"; this.btnLast.Size = new System.Drawing.Size(83, 32); this.btnLast.TabIndex = 11; this.btnLast.Text = "Last"; this.btnLast.UseVisualStyleBackColor = true; this.btnLast.Click += new System.EventHandler(this.btnLast_Click); // // btnPrevious // this.btnPrevious.Location = new System.Drawing.Point(394, 337); this.btnPrevious.Name = "btnPrevious"; this.btnPrevious.Size = new System.Drawing.Size(83, 32); this.btnPrevious.TabIndex = 12; this.btnPrevious.Text = "Previous"; this.btnPrevious.UseVisualStyleBackColor = true; this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click); // // btnFirst // this.btnFirst.Location = new System.Drawing.Point(483, 337); this.btnFirst.Name = "btnFirst"; this.btnFirst.Size = new System.Drawing.Size(83, 32); this.btnFirst.TabIndex = 13; this.btnFirst.Text = "First"; this.btnFirst.UseVisualStyleBackColor = true; this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click); // // txtPosition // this.txtPosition.Location = new System.Drawing.Point(12, 343); this.txtPosition.Name = "txtPosition"; this.txtPosition.Size = new System.Drawing.Size(198, 26); this.txtPosition.TabIndex = 14; // // rtxtAnswer // this.rtxtAnswer.Location = new System.Drawing.Point(193, 77); this.rtxtAnswer.Name = "rtxtAnswer"; this.rtxtAnswer.Size = new System.Drawing.Size(181, 254); this.rtxtAnswer.TabIndex = 15; this.rtxtAnswer.Text = ""; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(2, 58); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(72, 16); this.label3.TabIndex = 16; this.label3.Text = "Question"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(190, 58); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(96, 16); this.label4.TabIndex = 17; this.label4.Text = "Your Answer"; // // button1 // this.button1.Location = new System.Drawing.Point(483, 299); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 32); this.button1.TabIndex = 18; this.button1.Text = "Update"; this.button1.UseVisualStyleBackColor = true; // // btnDelete // this.btnDelete.Location = new System.Drawing.Point(564, 299); this.btnDelete.Name = "btnDelete"; this.btnDelete.Size = new System.Drawing.Size(75, 32); this.btnDelete.TabIndex = 19; this.btnDelete.Text = "Delete"; this.btnDelete.UseVisualStyleBackColor = true; this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); // // btnInsert // this.btnInsert.Location = new System.Drawing.Point(645, 299); this.btnInsert.Name = "btnInsert"; this.btnInsert.Size = new System.Drawing.Size(75, 32); this.btnInsert.TabIndex = 20; this.btnInsert.Text = "Insert"; this.btnInsert.UseVisualStyleBackColor = true; this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click); // // btnLocate // this.btnLocate.Location = new System.Drawing.Point(726, 299); this.btnLocate.Name = "btnLocate"; this.btnLocate.Size = new System.Drawing.Size(75, 32); this.btnLocate.TabIndex = 21; this.btnLocate.Text = "Locate"; this.btnLocate.UseVisualStyleBackColor = true; this.btnLocate.Click += new System.EventHandler(this.btnLocate_Click); // // txtInput // this.txtInput.Location = new System.Drawing.Point(619, 345); this.txtInput.Name = "txtInput"; this.txtInput.Size = new System.Drawing.Size(127, 26); this.txtInput.TabIndex = 22; // // btnSave // this.btnSave.Location = new System.Drawing.Point(807, 299); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(75, 32); this.btnSave.TabIndex = 23; this.btnSave.Text = "Save"; this.btnSave.UseVisualStyleBackColor = true; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // btnCancel // this.btnCancel.Location = new System.Drawing.Point(807, 337); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 32); this.btnCancel.TabIndex = 24; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // cboContests // this.cboContests.FormattingEnabled = true; this.cboContests.Location = new System.Drawing.Point(690, 12); this.cboContests.Name = "cboContests"; this.cboContests.Size = new System.Drawing.Size(121, 24); this.cboContests.TabIndex = 25; // // frmTest // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(894, 388); this.Controls.Add(this.cboContests); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnSave); this.Controls.Add(this.txtInput); this.Controls.Add(this.btnLocate); this.Controls.Add(this.btnInsert); this.Controls.Add(this.btnDelete); this.Controls.Add(this.button1); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.rtxtAnswer); this.Controls.Add(this.txtPosition); this.Controls.Add(this.btnFirst); this.Controls.Add(this.btnPrevious); this.Controls.Add(this.btnLast); this.Controls.Add(this.btnNext); this.Controls.Add(this.rtxtContents); this.Controls.Add(this.dgvContents); this.Controls.Add(this.lblContents); this.Controls.Add(this.btnCommit); this.Controls.Add(this.txtName); this.Controls.Add(this.txtNo); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "frmTest"; this.Text = "Database&C#"; this.Load += new System.EventHandler(this.frmTest_Load); ((System.ComponentModel.ISupportInitialize)(this.dgvContents)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox txtNo; private System.Windows.Forms.TextBox txtName; private System.Windows.Forms.Button btnCommit; private System.Windows.Forms.Label lblContents; private System.Windows.Forms.DataGridView dgvContents; private System.Windows.Forms.RichTextBox rtxtContents; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnLast; private System.Windows.Forms.Button btnPrevious; private System.Windows.Forms.Button btnFirst; private System.Windows.Forms.TextBox txtPosition; private System.Windows.Forms.RichTextBox rtxtAnswer; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button btnDelete; private System.Windows.Forms.Button btnInsert; private System.Windows.Forms.Button btnLocate; private System.Windows.Forms.TextBox txtInput; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.ComboBox cboContests; } }
相关推荐
这只是公司的初步设计方案、可能还需更改(到时大家可交流交流),不过基本已成形,希望对欲了解ERP系统的同志有所帮助
学习"数据库系统概论"可以帮助你更好地使用数据库,设计适合你需要的数据库应用系统,并进一步科学地管理好数据库系统。 课程概述 "数据库系统概论"是计算机科学与技术专业、软件工程专业、信息系统与信息管理等...
初步完成了对高校就业信息的管理,界面设计简洁,使用简单。 2.2高校就业管理系统数据流图实现院系、专业、毕业生信息管理(设有就业标志,初值为‘待业’); 实现职业类型、职业信息(职业号、类型号、需求数量、...
数据库系统采用SQL Server,前台开发工具选用JAVA,PowerBuilder,VC++等; (4)销售管理系统所涉及的信息有: ●客户信息。包括的数据项有:客户代码、名称、联系人,地址、电话,手机,传真,邮编,E-mail,税号,...
本课程的设计的目的是通过实践使同学们经历数据库设计、应用系统开发的全过程和受到一次综合训练,以便能较...结合具体的开发案例,理解并初步掌握系统分析、系统设计、系统实施的主要环节和步骤以及软件文档的制作能力
数据库设计是指对于一个给定的应用环境,构造最优的数据库模式,建立数据库及其应用系统,使之能够有效地存储数据。 1 数据库设计的基本步骤: 2 概念结构设计 2.1 E-R模型基本符号 2.2 初步E-R图设计 2.3 ...
华科数据库课程实验13——网上书店管理系统数据库设计。压缩文件包括一个sql文件和WORD文档,其中SQL为初步实现的数据库文件;WORD文档描述了需求分析、数据字典、ER图、ER图转换为关系模式以及初步具体实验代码截图...
智能调度系统数据库架构初步设计方案.pdf
从而使对数据库开发的感性认识和具体实践相结合,帮助学生初步掌握管理数据库的基本开发技术与方法,为进一步学习管理信息系统开发等知识打下良好的基础。从而具有一定的管理数据库的开发能力。
数据库课设设计报告 项目名称初步定为:宾馆住宿管理系统的开发。分为三个子功能模块:管理员登陆模块、房间信息预览模块,订房系统模块,退房系统模块和结账模块。自己辛苦写的
在数据库设计完成后,可以进行初步的索引设计,好的索引设计可以指导编码阶段写出高效率的代码,为整个系统的 性能打下良好的基础。 以下是性能要求设计阶段需要注意的: 1.3.1 数据库逻辑设计的规范化 数据库逻辑...
《数据库课程设计》指导书 一、数据库课程设计目的 关系数据库技术应用SQLSERVER、或者ACCESS数据库课程设计作为独立的教学环节, 是学习完《数据库系统》课程后进行的一次全面的综合练习。其目的在于加深对关系数据...
数据库原理与应用课程设计文档,doc格式,课程的重点是使学生掌握数据库的设计、实现、开发一个管理信息系统的方法和步骤,培养学生数据库设计、实现和开发小型管理信息系统的初步能力。 通过本课程实训,学生可以...
数据库课程 设计通过社会调查,选择一个实际课题,完成数据库应用系统设计工作,课程结束后提 交应用软件系统和课程设计报告。通过课程设计,可以较全面地理解、掌握和综合运用 所学知识,培养调查研究,查阅技术...
数据库系统---数据库设计 1. 数据库设计的⽅法 ⽬前已有的数据库设计⽅法可分为四类,即直观设计法、规范设计法、计算机辅助设计法和⾃动化设计法。直观设计法⼜称单步逻辑设计 法,它依赖于设计者的知识、经验和...
通过本实验,综合运用前面掌握的内容并进行综合应用。选定一种开发工具(VC)设计实现一个简单的数据库应用系统, 做到界面友好、使用方便。
消息系统数据库表设计 初步设计消息系统,⽤户表的字段待完善;这⾥把分组和群组放⼀张表⽤类型区分