2014-11-21 4 views
0

안녕하세요, 저는이 코드를 사용하여 webservice에서 가져 오기 위해 노력하고 있습니다. 이러한 오류를 기억하고 있으며 이유를 모르겠습니다. 내가 ...이름 서비스가 현재 컨텍스트 및 WebReferrence 오류에 존재하지 않습니다.

오류 모든 노력을했다 :

The name 'service' does not exist in the current context 

WebReference.CheckPartStatus.Parts' cannot be used like a method. 

내 코드 : 음

string CustomerID = "5943197"; 
    // 1off 


    WebReference.WebServiceTyped ws = new WebReference.WebServiceTyped(); 
    WebReference.CheckPartStatus PQ = new WebReference.CheckPartStatus(); 
    string Parts = ""; 
    string PartNumber = Parts; 
    string PriceSum = null; 
    long QtySum = 0; 

    PartNumber = "RS5117"; 
    if (PartNumber == "RS5117") 
    { 
     PQ = ws.CheckPartNumberStatus(PartNumber, CustomerID, "1,6,8,9,112", "", "", ""); 
     PriceSum = String.Format(PQ.Parts(0).Cost, "####.00"); 

     Label1.Text = PriceSum; 
    } 

답변

0

어딘가에 선언되지 않은 service라는 변수가있다 범위에서 Ctrl + F를 눌러서 문제가없는 코드를 찾을 수 있어야합니다. 실제로 코드에 없습니다. 위. 다른 오류가이 선에 대해 불평

저는 믿습니다 :

PriceSum = String.Format(PQ.Parts(0).Cost, "####.00"); 

당신이 방법으로 PQ.Parts (0)에 전화 곳. 아마해야합니다 :

PriceSum = String.Format(PQ.Parts[0].Cost, "####.00"); 
추측에

, 또는 전혀 색인이되어 있지 않은 경우, 그렇지 않으면 PQ.Parts.Cost, 부품 속성이 아닌 방법이기 때문이다.

관련 문제