关于ADO做入出库的问题
ADO做入出库的时候我就不会写了
请大家帮忙啊
void CWz2Dlg::OnSave()
{ CString str,Vid,Vname,Vmodel,Vnum,Vprice;
m_id.GetWindowText(Vid);
m_name.GetWindowText(Vname);
m_model.GetWindowText(Vmodel);
m_price.GetWindowText(Vprice);
m_num.GetWindowText(Vnum);
_RecordsetPtr pRs2;
int i;
pRs2->Open("select count(*) as i from info where Name=Vname and Model=Vmodel ",(IDispatch*)theApp.con,adOpenDynamic,adLockOptimistic,adCmdText);先查找有没有类型和名子和要入库或出库的东西一样的 有的话标记i
if(i==0)
{
str="insert into info (ID,Name,Model,Num,Price) values ("+Vid+",'"+Vname+"','"+Vmodel+"','"+Vnum+"','"+Vprice+"')";
pCmd->CommandText=(_bstr_t)str;
MessageBox(str);
pCmd->Execute(NULL,NULL,1);
MessageBox(str);
pRs->Requery(0);
display();
}
else
{
if(fill=='+')//到这里就不行了 当入库时只在num里加 但不知道怎么做类型转换啊
{
str="update info set ID ='"+Vid+"',Name='"+Vname+"',Model='"+Vmodel+"',Price='"+Vprice+"',Num='"+Vnum+"' where Name=='"+Vname+"' and Model=='"+Vmodel+"';
pCmd->CommandText=(_bstr_t)str;
pCmd->Execute(NULL,NULL,1);
pRs->Requery(0);
display();
}
}
}