Connection dropdown is unresponsive and/or empty

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

Connection dropdown is unresponsive and/or empty

Post by bclayshannon » Wed 14 Mar 2012 18:42

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...

Duke
Devart Team
Posts: 476
Joined: Fri 29 Oct 2004 09:25

Re: Connection dropdown is unresponsive and/or empty

Post by Duke » Fri 16 Mar 2012 12:08

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.

bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

Went a different route

Post by bclayshannon » Fri 16 Mar 2012 15:31

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.

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Tue 20 Mar 2012 14:58

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

bclayshannon
Posts: 29
Joined: Wed 14 Mar 2012 18:37
Location: Monterey, California

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

Post by bclayshannon » Tue 20 Mar 2012 15:23

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

Post Reply