Home > Software engineering >  Take the clistctrl with ado circulation more rows of data and insert essentially a database problem
Take the clistctrl with ado circulation more rows of data and insert essentially a database problem

Time:10-08

 


Incomplete when inserting data into some blank filling don't know why everybody to help me have a look at the thank you

CodePudding user response:

Cstrings Order;
Cstrings Addressee;
Cstrings MaiID;
Cstrings Address;
Cstrings Express;
Cstrings ExpressNumber;
Cstrings strSQL;
_variant_t RecordsAffected;
int i=0;
Int ncount=p_list. GetItemCount ();
StrSQL. The Format (_T (" INSERT INTO order1info (maiid order1, addressee, address, express) VALUES (' % s', '% s',' % s', '% s',' % s') "), the Order, and addressee, maiid, address, express);
Try
{
M_pconnection. CreateInstance (" ADODB. Connection ");
M_pconnection - & gt; The ConnectionString=_T (" Provider=SQLOLEDB. 1; Integrated Security=SSPI; Persist Security Info=False; Data Source=QH - 20160810 ZMWN \ \ SQLEXPRESS ");
M_pconnection - & gt; Open (" ", ""," ", adModeUnknown);

//- circular insert the data -//
While (i{

Order=p_list. GetItemText (I, 0).
Addressee=p_list. GetItemText (I, 1);
MaiID=p_list. GetItemText (I, 2);
Address=p_list. GetItemText (I, 3);
Express=p_list. GetItemText (I, 4);
ExpressNumber=p_list. GetItemText (I, 5);
Int ll=0;
M_pconnection - & gt; Execute ((_bstr_t) strSQL, & amp; RecordsAffected adCmdText);
+ + I;
}

}
Catch _com_error (ee)
{
Cstrings errormessagee;
Errormessagee. The Format (_T (" failed to connect to the database insert! \ r \ n error message: % s "), ee. The ErrorMessage ());
AfxMessageBox (errormessagee);
}

CodePudding user response:

This is the code I wrote to debug the value no problem is to insert some shows that some did not

CodePudding user response:

To ensure that the query analyzer performed manually inserted in no problem,
  • Related