using System;
using System;
using System.IO;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
Oracle.DataAccess.Client;
using
Oracle.DataAccess.Types;
namespace
FunctionsTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private
void Form1_Load(object
sender, EventArgs e)
{
}
public static void
PopulateDataTables()
{
// Connect to database orcl , user HR, pasword hr
OracleConnection
conn = new OracleConnection();
conn.ConnectionString = "Data Source=" + "orcl" +
";Persist Security Info=true;User ID=" + "hr" +
";Password=" + "hr" + ";";
conn.Open();
{
public partial class Form1 : Form
public Form1()
{
InitializeComponent();
}
{
{
// Connect to database orcl , user HR, pasword hr
conn.ConnectionString = "Data Source=" + "orcl" +
";Persist Security Info=true;User ID=" + "hr" +
";Password=" + "hr" + ";";
conn.Open();
// create dataset
DataSet dts = new DataSet();
/* fill data adapter with "dba_users" (1st query result) "dba_tablespaces"(2nd query result)
* "inv_obj"((2nd query result)*/
try
String queryString = " select username, user_id, password,account_status, lock_date," +
" expiry_date,default_tablespace,temporary_tablespace, " +
" created, profile, initial_rsrc_consumer_group,external_name, " +
" instr(account_status,'LOCKED') sts,instr(account_status,'EXPIRED') exped " +
" from sys.dba_users order by USERNAME";
OracleCommand command = new OracleCommand(queryString, conn);
OracleDataAdapter da = new OracleDataAdapter(command);
if (!dts.Tables.Contains("dba_users"))
dts.Tables.Add("dba_users");
da.Fill(dts, "dba_users");
command = new OracleCommand(queryString, conn);
da = new OracleDataAdapter(command);
if (!dts.Tables.Contains("dba_tablespaces"))
dts.Tables.Add("dba_tablespaces");
da.Fill(dts, "dba_tablespaces");
" FROM DBA_OBJECTS o " +
" WHERE o.STATUS='INVALID'";
command = new OracleCommand(queryString, conn);
da = new OracleDataAdapter(command);
if (!dts.Tables.Contains("inv_obj"))
dts.Tables.Add("inv_obj");
da.Fill(dts, "inv_obj");
catch (OracleException oex)
{
}
}