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
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();
}
}
}
}