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 62 63 64 65 66 67 68 69 70 71 72
|
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using Oracle.DataAccess.Client;
using System.Text;
using System.Collections.Generic;
namespace WebApplication4
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string cs1 = "DATA SOURCE=bdpbc;PERSIST SECURITY INFO=True;USER ID=bdpbcadmin;PASSWORD=bdpbcadmin123";
DataSet ENG = new DataSet();
string req0 = "select cpte, identif, aut_deb, utl_debit, aut_com, utl_come, aut_fct, utl_fcte, aut_cmlt, utl_cmlte, aut_rsp, utl_rspe, aut_esg, utl_esge, impaye, mmm, smv, periode,id from eng_dge@dbcg_bdpbc, portefeuille where periode = ";
string req1 = "'31-Oct.-2010'";
string req2 = "and eng_dge.cpte=portefeuille.n_cpte";
string req = req0 + req1 + req2;
ENG = Prepar_ENG(cs1, req);
GridView1.DataSource = ENG.Tables[0];
GridView1.DataBind();
}
DataSet Prepar_ENG ( string cs , string requete)
{
DataSet ENG = new DataSet();
try
{
OracleConnection connexion = new OracleConnection(cs);
// ouverture connexion
connexion.Open();
OracleDataAdapter da = new OracleDataAdapter();
OracleCommand sqlCommand = new OracleCommand(requete, connexion);
da.SelectCommand = sqlCommand;
da.Fill(ENG);
da.Dispose();
sqlCommand.Dispose();
connexion.Close();
}
catch (Exception ex)
{
// msg d'erreur
Console.WriteLine("Erreur d'accès à la base de données (" + ex.Message + ")");
}
return ENG;
}
}
} |
Partager