Search found 29 matches

by bclayshannon
Fri 06 Apr 2012 16:08
Forum: dotConnect for Oracle
Topic: Why is the OracleDataReader that I'm using null?
Replies: 3
Views: 1057

Is declaring "Result" as an Output param really necessary?

Isn't this unnecessary if you call

Code: Select all

command.Prepare();
?
by bclayshannon
Fri 06 Apr 2012 00:31
Forum: dotConnect for Oracle
Topic: Why is the OracleDataReader that I'm using null?
Replies: 3
Views: 1057

Why is the OracleDataReader that I'm using null?

With this code (DotConnect Oracle components):

Code: Select all

public List GetApplications(long userABCID) {
       List result = new List();
  try {
    using (OracleCommand command = con.CreateCommand()) {
      command.CommandType = System.Data.CommandType.StoredProcedure;
      command.CommandText = "REPORT.ApplicationPermission.GetApplicationCursor";
      // I tried getting just the Application name this way, too:
      //command.CommandText = "REPORT.ApplicationPermission.ApplicationString";
      command.ParameterCheck = true;
      command.Prepare();
      command.Parameters["iWorkerABCID"].Value = userABCID;

using (OracleDataReader reader = ((OracleCursor)command.Parameters["Result"].OracleValue).GetDataReader()) {
      while (reader.Read()) {
        result.Add(reader.GetString("AppName").ToLower());
      }
    }
...I'm getting "Object reference not set to an instance of an object"
by bclayshannon
Fri 30 Mar 2012 16:08
Forum: dotConnect for Oracle
Topic: Looping through a result set and accessing the values should
Replies: 3
Views: 1384

That works!

Thanks! I knew it should be something simple like that.
by bclayshannon
Wed 28 Mar 2012 23:21
Forum: dotConnect for Oracle
Topic: Looping through a result set and accessing the values should
Replies: 3
Views: 1384

Looping through a result set and accessing the values should

...not be this hard.

Here's my method (ACurrentUserRoles is a List of Strings):

Code: Select all

public void PopulateCurrentUserRoles(String AUserName, List ACurrentUserRoles) { 
  _UserName = AUserName; 
 
  String query = "select roleid from ABCrole where ABCid = :ABCID"; 
  Devart.Data.Oracle.OracleCommand cmd = new Devart.Data.Oracle.OracleCommand(query, con); 
  cmd.CommandType = CommandType.Text; 
  int _ABCID = GetABCIDForUserName(); 
  cmd.Parameters.Add("ABCID", _ABCID); 
  cmd.Parameters["ABCID"].Direction = ParameterDirection.Input; 
  cmd.Parameters["ABCID"].DbType = DbType.String; 
  cmd.Parameters.Add("cur", Devart.Data.Oracle.OracleDbType.Cursor); 
  cmd.Parameters["cur"].Direction = ParameterDirection.Output; 
  //cmd.ExecuteNonQuery(); blows up: "illegal variable name/number" 
  //cmd.ExecuteCursor();   " " 
  //cmd.ExecuteReader();   " " 
  Devart.Data.Oracle.OracleCursor oraCursor = 
    (Devart.Data.Oracle.OracleCursor)cmd.Parameters["cur"].Value; 
  Devart.Data.Oracle.OracleDataReader odr = oraCursor.GetDataReader(); // "Object reference not set to an instance of an object" 
  while (odr.Read()) { 
    ACurrentUserRoles.Add(odr.GetString(0)); 
  } 
}


The err msgs I'm getting are appended as comments to the lines where they occur.

Can anybody show me how to get this to work – loop through a result set and assign the values to a List?
by bclayshannon
Wed 28 Mar 2012 21:31
Forum: dotConnect for Oracle
Topic: Why do I error out when trying to retrieve a result set?
Replies: 1
Views: 1013

Why do I error out when trying to retrieve a result set?

With the code below I get, "ORA-01036: illegal variable name/number" on the call to ExecuteReader

Code: Select all

cmd.Parameters.Add("cur", Devart.Data.Oracle.OracleDbType.Cursor);
cmd.Parameters["cur"].Direction = ParameterDirection.Output;
Devart.Data.Oracle.OracleCursor oraCursor =
	(Devart.Data.Oracle.OracleCursor)cmd.Parameters["cur"].Value;
Devart.Data.Oracle.OracleDataReader odr = cmd.ExecuteReader();
while (odr.Read()) {
	ACurrentUserRoles.Add(odr.GetString(0));
}
This forum doesn't seem to be very busy, so I'm going to post this on stackOverflow, too.
by bclayshannon
Wed 28 Mar 2012 20:59
Forum: dotConnect for Oracle
Topic: Analogue to ODP's OracleDataReader?
Replies: 2
Views: 971

A start?

Does this make sense:

Code: Select all

cmd.Parameters.Add("cur", OracleDbType.Cursor);
cmd.Parameters["cur"].Direction = ParameterDirection.Output;
OracleCursor oraCursor = (OracleCursor)cmd.Parameters["cur"].Value;
Devart.Data.Oracle.OracleDataReader odr = cmd.ExecuteReader();

while (odr.Read()) 
{
  ACurrentUserRoles.Add(odr.GetString(0));
}
(cmd is a Devart.Data.Oracle.OracleCommand)

?
by bclayshannon
Wed 28 Mar 2012 20:15
Forum: dotConnect for Oracle
Topic: Analogue to ODP's OracleDataReader?
Replies: 2
Views: 971

Analogue to ODP's OracleDataReader?

I've got this code in a project that was using ODP:

Code: Select all

OracleDataReader odr = cmd.ExecuteReader();
  while (odr.Read()) {
    ACurrentUserRoles.Add(odr.GetString(0));
}
What is the corresponding class to OracleDataReader that I can use with DotConnect?
by bclayshannon
Wed 28 Mar 2012 18:40
Forum: dotConnect for Oracle
Topic: Uninstall/reinstall instructions?
Replies: 2
Views: 3110

I got it

I uninstalled the new version via Control Panel, and then ran the .exe
by bclayshannon
Wed 28 Mar 2012 16:35
Forum: dotConnect for Oracle
Topic: Uninstall/reinstall instructions?
Replies: 2
Views: 3110

Uninstall/reinstall instructions?

For legal/registration reasons, I need to uninstall version 6.50.214.0 and then install an older version for which we have licenses (version 5.70, I'm guessing, based on the name of the .exe).

How do I first uninstall my current version, or is that necessary?
by bclayshannon
Wed 28 Mar 2012 16:09
Forum: dotConnect for Oracle
Topic: I've done it the hard way, now I want to do it the easy way
Replies: 1
Views: 974

I've done it the hard way, now I want to do it the easy way

I've got a DataGridView populating with data from a Stored Proc via code. Now, though, I want to do it in a "quick and dirty" way at design time (doesn't have to be with the Stored Proc, could be a Select Query).

I haven't been able to figure out how to do it by playing around, and I haven't come up with any Tutorials on doing this. Supposedly it's quite easy and "Delphi-like" but I need some help.

Does anybody have a link to a Step-by-Step for this?

I simply want to use a Connection, Command, doubtless a DataSet and a DataAdapter, and populate the DataGridView (C# app in VS 2010) with the query results.
by bclayshannon
Wed 21 Mar 2012 15:33
Forum: dotConnect for Oracle
Topic: BeginTransaction
Replies: 4
Views: 1640

Dan Blocker

The "Unblock" worked - thanks!
by bclayshannon
Tue 20 Mar 2012 15:59
Forum: dotConnect for Oracle
Topic: BeginTransaction
Replies: 4
Views: 1640

Eureka!

Oh, I see - I was trying to call .BeginTransaction() on an OracleCommand component when I should have been calling it on OracleConnection. Here's my updated and working code:

Code: Select all

        private void UpdateRecord(string ATicketID, string ATicketSource, string AAboutLLSID, string ACategoryID, string AContactID)
        {
            oracleConnection1.Open();
            OracleCommand ocmd = new OracleCommand();
            OracleTransaction ot;
            // Start a local transaction 
            ot = oracleConnection1.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
            // Assign transaction object for a pending local transaction 
            ocmd.Transaction = ot;
            ocmd.Connection = oracleConnection1;
            try
            {
                ocmd.CommandText = @"UPDATE LLS.INTERPRETERTICKETS 
                                     SET TICKETSOURCE = :p_TICKETSOURCE, 
                                     ABOUTLLSID = :p_ABOUTLLSID, 
                                     CATEGORYID = :p_CATEGORYID, 
                                     CONTACTEMAIL = :p_CONTACTEMAIL 
                                     WHERE TICKETID = :p_TICKETID";
                ocmd.Parameters.Add("p_TICKETSOURCE", ATicketSource);
                ocmd.Parameters.Add("p_ABOUTLLSID", Convert.ToInt32(AAboutLLSID));
                ocmd.Parameters.Add("p_CATEGORYID", Convert.ToInt32(ACategoryID));
                ocmd.Parameters.Add("p_CONTACTEMAIL", AContactID);
                ocmd.Parameters.Add("p_TICKETID", ATicketID);
                ocmd.ExecuteNonQuery();
                ot.Commit();
                Popul8TheGrid();
            }
            catch (Exception e)
            {
                ot.Rollback();
                throw;
            }
            finally
            {
                oracleConnection1.Close();
            }
        }
by bclayshannon
Tue 20 Mar 2012 15:48
Forum: dotConnect for Oracle
Topic: BeginTransaction
Replies: 4
Views: 1640

Help file unavailable

In connection with my Transaction dilemma, I downloaded the .chm file from the bottom of this page:

http://www.devart.com/dotconnect/oracle/features.html

...but it contains only a structure, no content (or the content is unavailable, at any rate).

Can anybody point me to a dotConnect Transaction tutorial or some such?
by bclayshannon
Tue 20 Mar 2012 15:23
Forum: dotConnect for Oracle
Topic: Connection dropdown is unresponsive and/or empty
Replies: 4
Views: 1108

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

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();
}
by bclayshannon
Tue 20 Mar 2012 00:19
Forum: dotConnect for Oracle
Topic: BeginTransaction
Replies: 4
Views: 1640

BeginTransaction

This page:

http://www.devart.com/dotconnect/oracle ... tions.html

shows this code:

Code: Select all

ot = oc.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
..but my code:

Code: Select all

OracleTransaction ot;
                ot = oc.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
                // Assign transaction object for a pending local transaction 
                oc.Transaction = ot;
...gives this err msg.

'Devart.Data.Oracle.OracleCommand' does not contain a definition for 'BeginTransaction' and no extension method 'BeginTransaction' accepting a first argument of type 'Devart.Data.Oracle.OracleCommand' could be found (are you missing a using directive or an assembly reference?)

Why?