Difficulty connecting to local SQL Server Database
static System.Data.SqlClient.SqlConnection _connection = new System.Data.SqlClient.SqlConnection();
public static void Deploy(Dictionary<string, object> parameters)
{
string connectstring = DEFAULTPARAMVAL;
if (parameters.ContainsKey("ConnectionStringOptions"))
{
connectstring = (string)parameters["ConnectionStringOptions"];
}
_connection.ConnectionString = connectstring;
_connection.Open();
}The function I am implementing looks like the following:
public virtual int TagContained(string rfid)
{
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand();
command.Connection = _connection ;
command.CommandText = "dbo.TagContained" ;
command.CommandType = System.Data.CommandType.StoredProcedure ;
command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, 10, 0, null, System.Data.DataRowVersion.Current, false, null, "", "", ""));
command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@idnum", System.Data.SqlDbType.NVarChar, 1000, System.Data.ParameterDirection.Input, 0, 0, null, System.Data.DataRowVersion.Current, false, null, "", "", ""));
try
{
command.Parameters[1].Value = ((string)(rfid));
}
catch (Exception E)
{
LogMessage("Error in CommandCollection initialization: " + E.Message, Level.Error);
}
System.Data.ConnectionState previousConnectionState = command.Connection.State;
int returnValue = 0;
try
{
returnValue = (int)command.ExecuteNonQuery();
}
catch (Exception E)
{
LogMessage("Error in executing query: " + E.Message, Level.Error);
}
return returnValue ;
}
I get an assortment of the following errors in the process log:
73| Error|072007 13:29:55|Error in opening connection: The connection was not closed. The connection's current state is connecting.|[MyEventHandler]
97| Error|072007 13:29:55|Exception in ProcessTagReadEvent()->Evaluation: Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.|[MyEventHandler]
Furthermore, when I try to stop the process, the following error pops up after lagging in the "Action" status window
This request operation sent to net.tcp://a52--mxd5040280:7891/rfid/service/ProcessManager did not receive a reply within the configured timeout (00:01:00). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still processing the operation or because the service was unable to send a reply message. Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.
at Microsoft.SensorServices.Rfid.Management.ProxyBase.CallMethod(String methodName, Object[] args)
at Microsoft.SensorServices.Rfid.Management.ProcessManagerProxy.StopProcess(String processName, Boolean continueEventCollection)
at Microsoft.RadioFrequencyIdentification.Tools.ProcessNode.OnSyncAction(SyncAction action, SyncStatus status)

