2012-03-13 1 views
0
I가 STUDENTSINTEST 테이블의 두 열 봉착

다른 테이블 복합 기본 키로 개의 외래 키 속성을 설정할 , 이제 STUDENTSINTEST 테이블에 대한 복합 기본으로 두 개의 열을 설정하는 방법을 알고 싶습니까? 테이블이 이미모두 어떤 테이블 외래 키이다</p> <p>1.TestID 2.StudentID</p> <p>오라클

다른
alter table STUDENTSINTEST add constraint STUDENTSINTEST_PK primary key(TestID,StudentID); 

는 CREATE TABLE 문

constraint STUDENTSINTEST_PK primary key(TestID,StudentID) 

답변

3

을 감사합니다
0

<%@ page import="java.sql.*" %> 
<%@ page import="java.io.*" %> 
<%@ page import="java.util.ArrayList" %> 

<%@ page import="com.otts.*" %> 
<%@ page import="com.otts.dao.TestProfile" %> 

<%-- Variables declaration --%> 

<link type="text/css" href="/TandQMgmt/css/menu.css" rel="stylesheet" /> 
    <script type="text/javascript" src="jquery.js"></script> 
    <script type="text/javascript" src="menu.js"></script> 
<link href="/TandQMgmt/css/style.css" rel="stylesheet" type="text/css" /> 



<script src="../js/jquery.js" ></script> 
<script src="../js/jquery-ui.js" ></script> 
<script src="../js/jquery-validate.js" ></script> 



<body> 

<div class="contanier"> 
    <div class="content-beginner"> 
     <div class="logo"></div> 
     <div class="heading-bar"> 
      <div class="heading-text"></div> 
      <div class="clear"></div> 
     </div> 


             </ul></div> 
        </li> 

        </ul></div> 
        </li> 



        <li class="last"><a href="#"><span>Help & Support </span></a></li> 
        </ul> 
        </div> 

     <div class="clear"></div> 


     <script> 
$(function() { 
    $("input:submit").button();}) 
     function validateregisterform(){ 
    $("form#Formviewtest").validate(); 
    } 
</script> 




<% 

if(request.getAttribute("indicator")=="view"){ %> 

<p align="center"> 



       <table width="800" height="281" border="1" bgcolor="#FFFFFF"> 
    <tr> 
    <td height="33" colspan="7" bgcolor="#663300"><h1 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:16px; color:#FFF;">View Test Details</h1></td> 

    </tr> 
    <tr> 
    <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">TESTID</h2></td> 
    <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">TEST NAME</h2></td> 
    <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">TEACHER ID</h2></td> 
    <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">NO of PARTICIPANTS</h2></td> 
    <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">CURRENTLY ALLOCATED</h2></td> 
     <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">DURATION</h2></td> 
    <td width="96" bgcolor="#e3d5a8"><h2 style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:13px; color:#C30; text-align:center;">CREATED BY</h2></td> 
     </tr> 
<%ArrayList userList=null; 

userList=(ArrayList) request.getAttribute("totalResultSet"); 
for(int i=0;i<userList.size();i++) 
{ 
    TestProfile testProfile = (TestProfile) userList.get(i); 

    %> 

<tr> 

    <td><%out.print(testProfile.getTestId());%></td> 
    <td><%out.print(testProfile.getTestName());%></td> 
    <td><%out.print(testProfile.getTeacherId());%></td> 
    <td><%out.print(testProfile.getNumberOfParticipants());%></td> 
    <td><%out.print(testProfile.getCurrentlyAllocated());%></td> 
    <td><%out.print(testProfile.getDuration());%> </td> 
    <td><%out.print(testProfile.getCreatedBy()); %> </td> 



</tr> 


<% }%> 
</p> 

</table> 

<%} 
else { %> 





<form name="Formviewtest" id="Formviewtest" onsubmit="return validateregisterform()" action="../TestandQuestionManagement" method="post"> 
<pre> 







                <input type="submit" name ="Submit" value="View Test"></input> 
</pre> 


</div> 

    </div> 


</div> 


</form> 

</body> 
</html> 
<%}%> 
다음 문을 추가 할 수 있습니다 정의 된 경우 도움을 ....
+3

나는 이것이 무엇인지 잘 모르겠습니다. 이 코드가 귀하의 질문에 중요하다고 생각되면 질문을 편집하여 포함하십시오. 그러나 JSP 코드가 여러분이 물어 본 질문에 어떤 영향을 미치는지는 분명하지 않습니다. –

0
<script type="text/javascript"> 
function show_confirm() 
{ 
var r=confirm("Do You wish to update test details?"); 
if (r==true) 
    { 
    alert("Test details updated!"); 
    } 
return false; 

} 
function validate(form){ 


    var testName1 = form.testName.value; 
    var duration1 = form. duration.value; 
    var noofParticipants1 = form.noofParticipants.value; 
    var teacherId1 = form.teacherId.value; 

    if(testName1.length==0){ 
     alert("Please enter a Test name"); 
      return false; 
    } 
    if(testName1.length>10){ 
     alert("Please enter a Test name lessthan or equal to 10"); 
      return false; 
    } 
    if(duration1.length==0){ 

     alert("Please enter a test duration"); 
     return false; 
    } 
    if(duration1/1!=duration1){ 
     alert("Please enter a test duration in numbers"); 
     return false; 
    } 
    if(duration1<15) 
    { 
     alert("Please enter a test duration greater than 15"); 
     return false; 
    } 
    if(duration1>300) 
    { 
     alert("Please enter a test duration less than 300"); 
     return false; 
    } 
    if(noofParticipants1.length==0){ 
     alert("Please enter a number of participants"); 
      return false; 
    } 
    if(noofParticipants1/1!=noofParticipants1){ 
     alert("Please enter a number of participants in numbers"); 
     return false; 
    } 

    if(teacherId1.length==0){ 
     alert("Please enter a Teacher Id"); 
      return false; 
    } 
    if(teacherId1/1!=teacherId1){ 
     alert("Please enter a teacher Id in numbers"); 
     return false; 
    } 

    return true; 

} 


</script> 
<title>Update test</title> 
0
public static String DRIVERNAME="oracle.jdbc.driver.OracleDriver"; 
    public static String SERVERNAME = "172.24.137.30"; 
    public static String PORTNUMBER = "1521"; 
    public static String SID = "ora10G"; 
    public static String URL = "jdbc:oracle:thin:@" + SERVERNAME + ":" + PORTNUMBER + ":" + SID; 
    public static String USERNAME = "e554893 "; 
    public static String PASSWORD = "VAnjrmfvi"; 


Connection conn = null; 
     try { 
      // load the JDBC-ODBC Bridge driver 
      Class.forName(Constants.DRIVERNAME); 
      conn = DriverManager.getConnection(Constants.URL, 
        Constants.USERNAME, Constants.PASSWORD); 

     } 

     catch (Exception ex) { 
      System.out.println("Connection not created"); 
     } 
     return conn;