title: object reference not set to an instance of an object in dll
body: <p>i wrote this method in my application and it works fine. i decided to create a DLL file for it.
  But the same method give me the error <strong>object reference not set to an instance of an object in dll</strong>.
  the code is</p>
  
  <pre><code>public void Try(string conStr, string storedProcedure)
      {
  
          try
          {
  
              //create a connection string
              sqlCon = new SqlConnection(conStr);
  
              // create command
              sqlCmd = new SqlCommand(sqlCmd.CommandText, sqlCon);
  
              //add command type
              sqlCmd.CommandType = CommandType.StoredProcedure;
  
              // add the stored procedure name
              sqlCmd.CommandText = storedProcedure;
  
              //Open connection
              sqlCon.Open();
  
              // Execute transaction
              sqlCmd.ExecuteNonQuery();
  
          }
          catch (Exception e)
          {
  
              throw e;
          }
          finally
          {
              // Close connection
              sqlCon.Close();
          }
  </code></pre>
  
  <p>The error ocuurs at :</p>
  
  <pre><code>sqlCmd = new SqlCommand(sqlCmd.CommandText, sqlCon);
  </code></pre>
  
  <p>What can be the problem ??</p>