摘要: 更新方法一,直接在GridView中来更新数据. 更新方法二,打开一个新的页面来更新数据. //更新 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; //PopulatePublishersGridView(); string sqlstr = getSQlStr(); bind(sqlstr); } //更新 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { OleDbConnection sqlcon = new OleDbConnection(GetConnection()); string sqlstr = 阅读全文
posted @ 2010-05-08 17:39 叮当小马 阅读(643) 评论(0) 推荐(0)
摘要: 根据主键来删除表中的数据。 //删除 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { OleDbConnection sqlConnection = new OleDbConnection(GetConnection()); string sqlstr = "delete from MResume where id=" + GridView1.DataKeys[e.RowIndex].Value.ToString() + ""; OleDbCommand sqlcom = new OleDbCommand(sqlstr, sqlConnection); sqlConnection.Open(); sqlcom.ExecuteNonQuery(); sqlConnection.Close(); //PopulatePubli 阅读全文
posted @ 2010-05-08 17:37 叮当小马 阅读(593) 评论(0) 推荐(0)
摘要: /// /// 分页技术,触发事件 /// /// /// protected void gridViewPublishers_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.DataSource = SortDataTable(GridView1.DataSource as DataTable, true); GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind(); } /// /// 分页实现 /// /// param name="da 阅读全文
posted @ 2010-05-08 17:34 叮当小马 阅读(690) 评论(0) 推荐(0)
摘要: GridView绑定数据. //绑定 public void bind(string str) { string oledbstr = ""; if (str != null && str != "") { oledbstr = str; } else { oledbstr = "select ID, 姓名,性别,出生日期,工作年限,证件类型,证件号,居住地,Email,手机号码,家庭电话,自我评价 from MResume order by id desc"; } OleDbConnection oledbcon = new OleDbConnection(GetConnection()); OleDbDataAdapter myda = new OleDbDataAdapter(oledbstr, oledbcon); DataSet 阅读全文
posted @ 2010-05-08 17:13 叮当小马 阅读(2046) 评论(0) 推荐(0)
摘要: Web.config配置 appSettings中配置access与sqlserver /appSettings 阅读全文
posted @ 2010-05-08 13:04 叮当小马 阅读(4973) 评论(0) 推荐(0)
摘要: /* *SQLServer添加操作实现 */ void CMFCSQLDlg::OnButton2() { // TODO: Add your control notification handler code here CString strsql; CString strnum="mynum3"; CString strage="myage3"; HRESULT hResult; _variant_t RecordsAffected; CoInitialize(NULL); _ConnectionPtr m_pAppConn; hResult = m_pAppConn.CreateInstance(("ADODB.Connection"));///创建Connection对象 if(SUCCEEDED(hResult)) { //m_pAppConn->Open("Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source = .\\DataBase\\aa.mdb", "","",adModeUnkno 阅读全文
posted @ 2010-05-08 11:47 叮当小马 阅读(2748) 评论(0) 推荐(0)
摘要: 读取edit的值及赋值 阅读全文
posted @ 2010-05-08 11:03 叮当小马 阅读(3251) 评论(0) 推荐(0)
摘要: /* *连接SQL */ void CMFCSQLDlg::OnButton3() { // TODO: Add your control notification handler code here _ConnectionPtr m_pConnection; // 在应用程序的InitInstance函数里加入 if(S_OK!=CoInitialize(NULL)) { AfxMessageBox("初始化COM库错误!"); }else { AfxMessageBox("初始化COM库成功!"); } // 连接数据库: HRESULT hr; //返回结果变量 try { hr=m_pConnection.CreateInstance("ADODB.Connection"); //创建Connection对象 if(SUCCEEDED(hr)) { //hr=m_pCo 阅读全文
posted @ 2010-05-08 10:59 叮当小马 阅读(7890) 评论(0) 推荐(0)