Reply grace, when the " give points " phase reported ! Check it out !

Category: VC/MFC -> Network Author: fangwp Date: 2007-12-24 16:40:58
 
fangwp
2007-12-24 16:40:58
The following Code Red have problems , material_classification integer , [ 1 ] , [ 0.75 ] , [ 0.5 ] , [ 0.25 ] are floating-point type .  
runtime error is :  
\ debug \ msado15.tlh (407)  :   warning   C4146:   unary   minus   operator   applied   to   unsigned   type,   result   still   unsigned  
\ FormulaInfo.cpp (68)  :   error   C2666:   '+'  :   4   overloads   have   similar   conversions  

code below  
//   insert operation  
void   CFormulaInfo :: SqlInsert ()  

//   connect to the database  
ADOConn   m_AdoConn;  
m_AdoConn.OnInitADOConn ();  

//   define UserType string variable  
//   CString   strUserType;  
// strUserType.Format("%ld", UserType); 

//   set Insert statement  
_bstr_t   vSQL;  
       
        vSQL   =   " INSERT   INTO   formula   ( file_id, material, material_classification, [1], [0.75], [0.5], [0.25], unit)   VALUES   ('"   +   name   +   "', '"   +   name_material   +   " ',  ' "   +   material_type   +   " ',' "   +   percent   +   " ',' "   +   percent1   +   " ',' "   +   percent2   +   " ',' "   +   percent3   +   " ', '"   +   unit   +   "') ";  

//   execute SQL statements  
m_AdoConn.ExecuteSQL (vSQL);  

//   disconnect the connection to the database  
m_AdoConn.ExitConnect ();  
}  
caidingxiong2010
2007-12-24 16:56:36
following a problem with code Red , material_classification integer , [ 1 ] , [ 0.75 ] , [ 0.5 ] , [ 0.25 ] are floating-point type .  
runtime error is :  
\ debug \ msado15.tlh (407)  :   warning   C4146:   unary   minus   operator   applied   to   unsigned   type,   result   still   unsigned  
\ FormulaInfo.cpp (68)  :   error   C2666:   '+'  :   4   overloads   have   similar   conversions  

code below  
//   insert operation  
void   CFormulaInfo :: SqlInsert ()  

//   connect to the database  
ADOConn   m_AdoConn;  
m_AdoConn.OnInitADOConn ();  

//   define UserType string variable  
//   CString   strUserType;  
// strUserType.Format("%ld", UserType); 

//   set Insert statement  
_bstr_t   vSQL;  
       
        vSQL   =   " INSERT   INTO   formula   ( file_id, material, material_classification, [1], [0.75], [0.5], [0.25], unit)   VALUES   ('"   +   name   +   "', '"   +   name_material   +   " ',  ' "   +   material_type   +   " ',' "   +   percent   +   " ',' "   +   percent1   +   " ',' "   +   percent2   +   " ',' "   +   percent3   +   " ', '"   +   unit   +   "') ";  

//   execute SQL statements  
m_AdoConn.ExecuteSQL (vSQL);  

//   disconnect the connection to the database  
m_AdoConn.ExitConnect ();  
sqyanxin
2007-12-24 17:14:31
vSQL   =   " INSERT   INTO   formula   (file_id, material, material_classification, [1], [0.75], [0.5], [0.25], unit)   VALUES   ('"   +   name   +   " ',' "   +   name_material   +   " ',  ' "   +   material_type   +   " ',' "   +   percent   +   " ',' "   +   percent1   +   " ',' "   +   percent2   +   " ',' "   +   percent3   +   " ',' "   +   unit   +   " ') ";  

into
vSQL   =   " INSERT   INTO   formula   (file_id, material, material_classification, [1], [0.75], [0.5], [0.25], unit)   VALUES   ('"   +   name   +   " ',' "   +   name_material   +   " ',  '   +   material_type   +   ',' +   percent   +   ','   +   percent1   ','   +   percent2   +   ','   +   percent3   +   ',' "   +   unit   +   " ' ) ";
chh621
2007-12-24 17:26:22
vSQL   =   " INSERT   INTO   formula   (file_id, material, material_classification, [1], [0.75], [0.5], [0.25], unit)   VALUES   ('"   +   name   +   "', '"   +   name_material   +   "', "   +   material_type   +   ", "   +   percent   +   ", "   +   percent1   +   ", "   +   percent2   +   ", "   +   percent3   +   ", '"   +   unit   +   "') ";  

integer and floating-point type to be remove the '
zhichitianya000
2007-12-24 17:41:15
can only look at the top of the