Page 1 of 1

Connection dropdown is unresponsive and/or empty

Posted: Wed 14 Mar 2012 18:42
by bclayshannon
I just downloaded the devConnect for Oracle trial, and am trying to get
a test project started.

When I start a VS 2010 project and select DevArt Database Projects |
Oracle Project Wizard, and then check the "Import schema..." checkbox,
the next form in the Wizard has a Connection dropdown that won't drop
down or open; maybe it's because there is nothing to show, but there
should be - I have a valid connection to an Oracle database...

Re: Connection dropdown is unresponsive and/or empty

Posted: Fri 16 Mar 2012 12:08
by Duke
bclayshannon wrote:I have a valid connection to an Oracle database...
If you have a valid connection if should be visible in Database Explorer tool window. If it's not, you need to create one by clicking Add Connection button on the toolbar in Database Explorer window.

Went a different route

Posted: Fri 16 Mar 2012 15:31
by bclayshannon
Thanks; I backed out of that and created a non-wizardized dotConnect app. My issue now is how to connect a DataGridView to the cursor I'm getting back from a StoredProc.

Posted: Tue 20 Mar 2012 14:58
by Pinturiccio
bclayshannon wrote:My issue now is how to connect a DataGridView to the cursor I'm getting back from a StoredProc.
I'm posting a small example. Let's consider that we have a procedure like in your post http://www.devart.com/forums/viewtopic.php?t=23630

Code: Select all

OracleConnection oracleConnection1 = new OracleConnection("Your connection string);
OracleCommand oracleCommand1 = new OracleCommand("CONN_THRU_DOTNET", oracleConnection1);
oracleCommand1.CommandType = CommandType.StoredProcedure;

OracleParameter pRes = new OracleParameter("C_REF", OracleDbType.Cursor);
pRes.Direction = ParameterDirection.InputOutput;
pRes.ParameterName = "c_ref";

oracleCommand1.Parameters.Clear();
int iFromYear = dateTimePickerFrom.Value.Year;
int iFromMonth = dateTimePickerFrom.Value.Month;
int iFromDay = dateTimePickerFrom.Value.Day;
int iToYear = dateTimePickerTo.Value.Year;
int iToMonth = dateTimePickerTo.Value.Month;
int iToDay = dateTimePickerTo.Value.Day;
oracleCommand1.Parameters.Add("iStartDate", new DateTime(iFromYear, iFromMonth, iFromDay));
oracleCommand1.Parameters.Add("iEndDate", new DateTime(iToYear, iToMonth, iToDay));
oracleCommand1.Parameters.Add("iCATEGORYID", 114);
oracleCommand1.Parameters.Add(pRes);
oracleConnection1.Open();
oracleCommand1.ExecuteNonQuery();

OracleCursor oraCursor = (OracleCursor)comm.Parameters["c_ref"].Value;
OracleDataAdapter oraDataAdapter = new OracleDataAdapter();
DataTable dt = new DataTable();
oraDataAdapter.Fill(dt, oraCursor);
dataGridView1.DataSource = dt;
oracleConnection1.Close();

Thanks for your help; this is what I got working yesterday

Posted: Tue 20 Mar 2012 15:23
by bclayshannon
Thanks,

Here's what I ended up getting to work yesterday. Once I got it working in a "sister app" using ODP, I "translated" it, more or less, to dotConnect:

private void Popul8TheGrid()
{
int iFromYear = dateTimePickerFrom.Value.Year;
int iFromMonth = dateTimePickerFrom.Value.Month;
int iFromDay = dateTimePickerFrom.Value.Day;
int iToYear = dateTimePickerTo.Value.Year;
int iToMonth = dateTimePickerTo.Value.Month;
int iToDay = dateTimePickerTo.Value.Day;

oracleCommand1.Parameters.Clear();
oracleCommand1.Parameters.Add("iStartDate", new DateTime(iFromYear, iFromMonth, iFromDay));
oracleCommand1.Parameters.Add("iEndDate", new DateTime(iToYear, iToMonth, iToDay));
oracleCommand1.Parameters.Add("iCATEGORYID", 114);
// OracleRef is apparently like OracleDbType.RefCursor;
OracleRef or = new OracleRef("_or");
oracleCommand1.Parameters.Add("cref", or);

oracleConnection1.Open();

oracleDataAdapter1.SelectCommand = oracleCommand1;
oracleDataAdapter1.GetFillParameters();
oracleDataAdapter1.Fill(oracleDataTable1);
dataGridView1.DataSource = oracleDataTable1;

oracleConnection1.Close();
}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
oracleConnection1.Close();
}