views:

441

answers:

2

The application uses Oracle DataAccess ver. 1.1. , VS 2008, .Net Framework 3.5 w/SP1

OracleConnection connection = new OracleConnection(ConnectionStringLogon); connection.Open();

OracleParameter selectParam = new OracleParameter(":applicationName", OracleDbType.Varchar2, 256); selectParam.Value = applicationName;

            if (connection.State != ConnectionState.Open)
                connection.Open();

            OracleCommand cmd = new OracleCommand();

            cmd.Connection = connection;
            cmd.CommandText = "Select ApplicationId from Applications where AppName = 'appName'";
            cmd.CommandType = CommandType.Text;

            if (selectParam != null)
            {
                    cmd.Parameters.Add(selectParam);
            }
            object lookupResult = cmd.ExecuteScalar();
            cmd.Parameters.Clear();

            if (lookupResult != null)

The procedure fails on object lookupResult = cmd.ExecuteScalar(); with this error:

Event Type: Error Event Source: App Log Event Category: None Event ID: 9961 Date: 9/30/2008 Time: 4:42:11 PM User: N/A Computer: Server15 Description: System.NullReferenceException: Object reference not set to an instance of an object. at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) at Oracle.DataAccess.Client.OracleCommand.ExecuteReader() at Oracle.DataAccess.Client.OracleCommand.ExecuteScalar() at Membership.OracleMembershipProvider.GetApplicationId(String applicationName, Boolean createIfNeeded) in OracleMembershipProvider.cs:line 1626

I've looked at this from every angle that I can conceive of... basically, no matter how I wrap it, the Execute fails.

+1  A: 

I notice your CommandText doesn't contain the specified parameter ":applicationName"

Duncan Smart
+1  A: 

It's not an error in "ExecuteReader". It's an error in the execution of the query... is applicationName null?

Sklivvz