Bonjour,
J'ai besoin de vos lumières...car ceci me dépasse largement...
J'ai besoin d'accéder à un BDD d'une société...mais elle ne me laisse qu'y accéder par Stored Procedures...
Comment faire...j'ai besoin d'aide et d'explications...
La société m'a envoyé un exemple écrit en C#...
Je dois apparement lancé une sorte de requête paramétré etc...et comment récuperer le résultat?
BAV
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 public partial class Form1 : Form { private OdbcConnection myConnection; private OdbcCommand myCommand; public Form1() { InitializeComponent(); // myConnection = new OdbcConnection(); myCommand = new OdbcCommand(); // myConnection.ConnectionString = "DSN=C2MEXT01;UID=GZAEXTUSR01;PWD=EXTUSR"; myCommand.Connection = myConnection; } private void button1_Click(object sender, EventArgs e) { try { myConnection.Open(); // myCommand.CommandType = CommandType.StoredProcedure; //myCommand.CommandText = "CALL C2MV5_SA.gva_odbc_PatientAdminData_O"; myCommand.CommandText = "{CALL C2MV5_SA.gva_odbc_PatientAdminData_O(?,?)}"; // OdbcParameter param1 = new OdbcParameter(); param1.ParameterName = "ContactNr"; param1.OdbcType = OdbcType.VarChar; param1.Size = 16; param1.Direction = ParameterDirection.Input; param1.Value = "9361429"; // OdbcParameter param2 = new OdbcParameter(); param2.ParameterName = "PatName"; param2.OdbcType = OdbcType.VarChar; param2.Size = 128; param2.Direction = ParameterDirection.Output; // myCommand.Parameters.Add(param1); myCommand.Parameters.Add(param2); // myCommand.ExecuteNonQuery(); // textBox1.Text = param2.Value.ToString(); // myConnection.Close(); } catch (Exception e1) { MessageBox.Show("exception : " + e1.Message); if (myConnection.State == ConnectionState.Open) { myConnection.Close(); } } } }
Partager