-
Notifications
You must be signed in to change notification settings - Fork 0
/
CL_CAD.cpp
61 lines (52 loc) · 1.37 KB
/
CL_CAD.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "CL_CAD.h"
using namespace NS_Composants;
CL_CAD::CL_CAD()
{
this->rq_sql = "RIEN";
this->cnx = "Data Source=LAW-ZBOOK\\MSSQLSERVER01;" +
"Initial Catalog=cesi;" +
"Persist Security Info=True;" +
"User ID=cxuser;" +
"Password=1234";
this->CNX = gcnew SqlConnection(this->cnx);
this->CMD = gcnew SqlCommand(this->rq_sql, this->CNX);
this->CMD->CommandType = CommandType::Text;
}
int CL_CAD::actionRowsID(String^ rq_sql)
{
int id;
this->setSQL(rq_sql);
this->CMD->CommandText = this->rq_sql;
this->CNX->Open();
id = Convert::ToInt32(this->CMD->ExecuteScalar());
this->CNX->Close();
return id;
}
void CL_CAD::actionRows(String^ rq_sql)
{
this->setSQL(rq_sql);
this->CMD->CommandText = this->rq_sql;
this->CNX->Open();
this->CMD->ExecuteNonQuery();
this->CNX->Close();
}
DataSet^ CL_CAD::getRows(String^ rq_sql, String^ dataTableName)
{
this->setSQL(rq_sql);
this->DA = gcnew SqlDataAdapter(this->CMD);
this->CMD->CommandText = this->rq_sql;
this->DS = gcnew DataSet();
this->DA->Fill(this->DS, dataTableName);
return this->DS;
}
void CL_CAD::setSQL(String^ rq_sql)
{
if (rq_sql == "" || rq_sql == "RIEN")
{
this->rq_sql = "RIEN";
}
else
{
this->rq_sql = rq_sql;
}
}