Repository navigation
Expand file tree
/
Copy pathCAD.cpp
More file actions
42 lines (37 loc) · 1.31 KB
/
Copy pathCAD.cpp
File metadata and controls
42 lines (37 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "CAD.h"
namespace Composants {
CAD::CAD(void) {
this->_requestSql = "";
this->_connectionString = "Data Source=.;Initial Catalog=gestionSoftware;Integrated Security=True";
this->_sqlConnection = gcnew SqlConnection(this->_connectionString);
this->_sqlCommand = gcnew SqlCommand(this->_requestSql, this->_sqlConnection);
this->_sqlCommand->CommandType = CommandType::Text;
}
DataSet^ CAD::getRows(System::String^ requestSql, String^ dataTableName) {
this->setSql(requestSql);
this->_sqlDataAdapter = gcnew SqlDataAdapter(this->_sqlCommand);
this->_sqlCommand->CommandText = this->_requestSql;
this->_dataSet = gcnew DataSet();
this->_sqlDataAdapter->Fill(this->_dataSet, dataTableName);
return this->_dataSet;
}
void CAD::actionRows(String^ requestSql) {
this->setSql(requestSql);
this->_sqlCommand->CommandText = this->_requestSql;
this->_sqlConnection->Open();
this->_sqlCommand->ExecuteNonQuery();
this->_sqlConnection->Close();
}
int CAD::actionRowsID(String^ requestSql) {
int id;
this->setSql(requestSql);
this->_sqlCommand->CommandText = this->_requestSql;
this->_sqlConnection->Open();
id = Convert::ToInt32(this->_sqlCommand->ExecuteScalar());
this->_sqlConnection->Close();
return id;
}
void CAD::setSql(String^ requestSql) {
this->_requestSql = requestSql;
}
}