2016-10-05 2 views
-2
private void button9_Click(object sender, EventArgs e) 
{ 
    clss.Connect(); 
    clss.search("select * from Employee E, AssetAllocation A WHERE E.EmployeeID=6 and A.EmployeeID=6"); 
    //, where E.EmployeeID=" + textBox12.Text + " and A.EmployeeID=" + textBox12.Text + ""); 
    while (clss.reader.Read()) 
    { 
     textBox11.Text = clss.reader["Department"].ToString(); 
     textBox10.Text = clss.reader["Emp_Name"].ToString(); 
     textBox9.Text = clss.reader["OfficeNumber"].ToString(); 
     listBox1.Items.Add(clss.reader["AllocationDate"].ToString()); 
    } 

    clss.reader.Close(); 
} 
+1

'clss'란 무엇입니까? 어떤 코드 행에서 예외가 발생합니까? – user1666620

+2

'clss'의 종류는 무엇입니까? 오류가 발생한 행은 무엇입니까? 어떤 DBMS입니까? –

+0

SQL 자체에 대해서 왜 'join'을 사용하지 않겠습니까? 'Employee로부터 select * E AssetAllocation A on E.EmployeeId = A.EmployeeId 여기서 E.EmployeeId = 6' –

답변

0

"하나 개 이상의 필수 매개 변수에 주어진 어떤 값이"정확히 무엇인지 CLSS을 명확히주세요라는 오류를 반환 예를 들어 어떤 매개 변수도 누락되었습니다 :

public class Employee { 
    public Employee(string Name) { 
     // Some Code Here 
    } 
} 

내게는 cls하지만 이름이 Employee가 아니며 가능성이 다른 인수가 있습니다. 그래서 아래 예제에서는 Employee 클래스에서 새 객체를 만들고 싶습니다. 그리고 오류를 유발하는 객체와 그렇지 않은 객체를 보여줍니다.

Employee karen = new Employee(); // Triggers the Error

Employee karen = new Employee("Karen"); // Doesn't Trigger Error

이것이 도움이되지 않는다면 유감입니다. 아니면 실제로 생각대로 작동하지 않습니다. 질문에 대한 답변을 처음 시도한 것입니다. 그리고 C#에서 코딩을 중단한지 얼마되지 않았습니다.

관련 문제