首页 新闻 赞助 找找看

dataset更新数据库

0
悬赏园豆:10 [已关闭问题]
<P>那位大哥有DATASET更新数据库的代码&nbsp;&nbsp; DATA的表结构跟数据库里的一个表的结构是一样的</P> <P>&nbsp;&nbsp;&nbsp; 帮帮忙啊&nbsp;&nbsp; 分不够可以加</P>
浩浩的主页 浩浩 | 初学一级 | 园豆:2
提问于:2008-05-16 11:20
< >
分享
其他回答(1)
0
用适配器可以更新,更新之前要先定义好insertcommand和参数设置。适配器好像有一个update方法是可以了。
李.net | 园豆:730 (小虾三级) | 2008-05-16 13:45
0
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Data.SqlClient; namespace Example_2 { /// <summary> /// frmIssueBooks 的摘要说明。 /// </summary> public class frmIssueBooks : System.Windows.Forms.Form { private System.Windows.Forms.Button btnBorrowBook; private System.Windows.Forms.GroupBox grpInsertDetails; private System.Windows.Forms.TextBox txtAuthor; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txtBookAccessCode; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txtStdID; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox txtStdName; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btnExit; private System.Windows.Forms.GroupBox grpBookDetails; private System.Windows.Forms.DataGrid dbgBooksDt; private System.Windows.Forms.ComboBox cboBookName; private System.Windows.Forms.TextBox txtIssueDate; private System.Windows.Forms.Label label6; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; private SqlDataAdapter objSqlDataAdapter,objBkDtAdapt; private SqlConnection objSqlConn; private DataSet objDataSet,objBkDtDs; private SqlParameter objParam; public frmIssueBooks() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// private bool ValidateFields() { bool returnValue=true; //检查图书访问码是否为空 if(this.txtBookAccessCode.Text.Trim()==string.Empty) { MessageBox.Show("提供完整的详细信息"); return false; } else { //检查学生姓名是否包含任何数字数
ڜǺ☻ďų | 园豆:208 (菜鸟二级) | 2008-05-29 15:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册