seeCreating a Custom ADO.NET DataAdapter
http://www.csharphelp.com/archives/archive193.html
Chapter 10: Submitting Updates to Your Database continued
http://www.microsoft.com/mspress/books/sampchap/5354g.asp
http://www.csharphelp.com/archives/archive193.html
Chapter 10: Submitting Updates to Your Database continued
http://www.microsoft.com/mspress/books/sampchap/5354g.asp
我用过selectCommand,这个命令不要UPData()就可以用。可是其它的好像就不太行了
在使用Da.Fill()或Da.Update()之前定义以下数据库操作语句。
//
//新增数据
//
Da.InsertCommand.CommandText = @"INSERT INTO test(f1, f2, f3) VALUES (@f1, @f2, @f3)";
Da.InsertCommand.Connection = this.myConnection;
Da.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@f1", System.Data.SqlDbType.VarChar, 2, "f1"));
Da.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@f2", System.Data.SqlDbType.VarChar, 6, "f2"));
Da.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@f3", System.Data.SqlDbType.Int, 4, "f3"));
//
//修改数据
//
Da.UpdateCommand.CommandText="";
........
//
//删除数据
//
Da.DeleteCommand.CommandText="";
........
//
//选择数据
//
Da.SelectCommand.CommandText="";
........