SendNSetRequest Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestSendNSetRequest ( )
{
   const string UID_SC_IMAGE_STORAGE = "1.2.840.10008.5.1.4.1.1.7";
   // Secondary Capture Image Storage
   short nRet = 0;
   string szClassUID = null;
   string szInstance = null;
   int hPDU = 0;
   short nID = 0;
   string szNewID = null;
   //this sample allows you to change the patient id of an SOP Instance
   //send an N-GET-REQUEST to the server
   szClassUID = UID_SC_IMAGE_STORAGE ;
   szInstance = "1.1.1.1";
   szNewID = "123-45-6789";
   //create the data set that encodes the changed element(s)
   LEADDICOM1.InitDS((int)LTDICLib.DicomClassConstants.DICOM_CLASS_UNKNOWN, 0);
   LEADDICOM1.ResetDS();
   LEADDICOM1.FindTag((int)LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_ID);
   LEADDICOM1.InsertElement(false, (int)LTDICLib.DicomDataSetTagConstants2.TAG_PATIENT_ID, LEADDICOM1.get_CurrentTag().VR, false, 0);
   LEADDICOM1.StringValueCount = 1;
   LEADDICOM1.set_StringValues(0, szNewID);
   LEADDICOM1.SetStringValue(1);
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet);
   //now, send a request
   nID = LEADDICOMNet1.FindPresentationAbstract(hPDU, szClassUID);
   if (nID == 0)
   {
      nRet = LEADDICOM1.FindUID(szClassUID);
      if (nRet == 0)
         MessageBox.Show("Abstract Syntax, " + LEADDICOM1.get_CurrentUID().Name + ", Not Supported by Association!");
      else
         MessageBox.Show("Abstract Syntax, " + szClassUID + ", Not Supported by Association!");
      return;
   }
   LEADDICOMNet1.SendNSetRequest(LEADDICOMNet1.hNet, nID, 1, szClassUID, szInstance, LEADDICOM1.hDicomDS);
}