首页上一页 1  下一页尾页 3 条记录 1/1页
        向记录集中添加数据,一直出现“操作失败”
                 	
                        发表在C语言图书答疑
                        2016-07-06                                                
                    		
                                                                            	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    ADO连接数据库成功了,但是就是添加不了数据,下面是我的程序:
void CWellPathDlg::OnBnClickedButtonAdd()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(true);
if(m_welldeep.IsEmpty())
{
MessageBox("井深不能为空!");
return;
}
if(m_decline.IsEmpty())
{
MessageBox("井斜角不能为空!");
return;
}
if(m_orient.IsEmpty())
{
MessageBox("方位角不能为空!");
return;
}
ADOConn m_AdoConn;
m_AdoConn.OnInitADOConn();
_bstr_t sql;
sql="selcet * from WellPath";
_RecordsetPtr m_pRecordset;
m_pRecordset=m_AdoConn.GetRecordSet(sql);
try
{
m_pRecordset->AddNew();
//m_pRecordset->PutCollect("井深",(_bstr_t)m_welldeep);
//m_pRecordset->PutCollect("井斜角",(_bstr_t)m_decline);
//m_pRecordset->PutCollect("方位角",(_bstr_t)m_orient);
m_pRecordset->GetFields()->GetItem("井深")->Value=(_bstr_t)m_welldeep;
m_pRecordset->GetFields()->GetItem("井斜角")->Value=(_bstr_t)m_decline;
m_pRecordset->GetFields()->GetItem("方位角")->Value=(_bstr_t)m_orient;
m_pRecordset->Update();
m_AdoConn.ExitConnect();
}
catch(_com_error e)
{
MessageBox("添加失败");
return;
}
MessageBox("保存成功");
m_grid_wellpath.DeleteAllItems();
AddGrid();
}

 
	
                                                 VIP会员
VIP会员 购物车
购物车

 私信
                         私信 
                     发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对( 
                    

 
                







 
                     
                     
					 
						 
						 
						 
						