Tiny few lines of code a day out here. Saturday had a good extremely uncomfortable. The code is simple, but the main reason is because some of the box is not checked when uploading data with partner software.
come on。。。。。。。
1, with two controls ADOConnection, ADOStoredProc.
1.1 associated with the connection to ADOStoredProc ADOConnection
1.2 ADOConnection connection sql server database (in two ways. I use the code in this connection, this is more flexible. Another way. I will not ask more than simple contact details below)
1.2.1 database connection
// connect SQL AnsiString conn = "Provider = the SQLOLEDB. 1 ; Password = password; of the Persist Security Info = to true; the User ID = username; Initial Cataog = database name; the Data Source = your IP address "; ADOConnection1 -> the ConnectionString = Conn; ADOConnection1 -> Connected = to true;
2, stored data download process, directly on the code
ADOStoredProc1 -> Connection = ADOConnection1; ADOStoredProc1 -> ProcedureName = "during storage name"; ADOStoredProc1 -> the Parameters -> the Refresh (); // parameter name: @ **** parameters: ***** ADOStoredProc1 -> the Parameters -> ParamByName ( "@ parameter") -> value = " parameter value "; ADOStoredProc1 -> Open (); // return value to determine whether this success to get based on your interface ShowMessage (ADOStoredProc1 -> the parameters ->ParamByName("@ Return value parameter ") -> Value); // here I get the value displayed on the ComboBox control for ( int J = 0 ; J < ADOStoredProc1 -> the RecordCount; J ++ ) { ADOStoredProc1 -> RecNo = J + . 1 ; the ComboBox1 -> the Items -> the Add (ADOStoredProc1 -> FieldByName ( "database field name") -> AsString); }
3, the download is complete
4, data upload
4.1 database connection
// connect SQL AnsiString conn = "Provider = the SQLOLEDB. 1 ; Password = password; of the Persist Security Info = to true; the User ID = username; Initial Cataog = database name; the Data Source = your IP address"; ADOConnection1 -> the ConnectionString = Conn; ADOConnection1 -> Connected = to true;
5, upload the data
ADOStoredProc1 -> Connection = ADOConnection1; ADOStoredProc1 -> ProcedureName = "stored procedure name"; ADOStoredProc1 -> the Parameters -> Refresh (); ADOStoredProc1 -> the Parameters -> ParamByName ( " @ parameter ") -> Value = upload number; ADOStoredProc1 -> ExecProc ();
6, finished live
QQ:3064349253