-1

このクエリでどのように連結しますか?

SQL

SELECT
  eventscheduling.eventID,
  event.eventName,
  event.description,
  sponsorCLUB.Organization,
  department.Dname,
  eventscheduling.smonth,
  eventscheduling.sdate, 
  eventscheduling.syear,
  eventscheduling.tHour,
  eventscheduling.tMinute,
  eventscheduling.tAmPm, 
  eventscheduling.venue,
  eventscheduling.representative 
FROM eventscheduling, event, department, sponsorCLUB
WHERE event.eventID=eventscheduling.eventID and 
  sponsorCLUB.sponsorID=eventscheduling.sponsorID and
  department.DeptID=sponsorCLUB.DeptID and 
  eventscheduling.eventID='"+txtsearch.getText()+"'";

コード

String sql="select eventscheduling.eventID, event.eventName, event.description,
 sponsorCLUB.Organization, department.Dname, eventscheduling.smonth, eventscheduling.sdate, 
eventscheduling.syear, eventscheduling.tHour, eventscheduling.tMinute, eventscheduling.tAmPm, 
eventscheduling.venue, eventscheduling.representative from eventscheduling, event, department, 
sponsorCLUB where event.eventID=eventscheduling.eventID and 
sponsorCLUB.sponsorID=eventscheduling.sponsorID and department.DeptID=sponsorCLUB.DeptID and 
eventscheduling.eventID='"+txtsearch.getText()+"'";

とを Date に結合したいと思いsmonthます。sdatesyear

4

1 に答える 1

1

DateSerial を使用して、構成要素から単一の日付を作成できます -
http://www.techonthenet.com/access/functions/date/dateserial.php

SELECT
  DateSerial(eventscheduling.syear,
             eventscheduling.smonth,
             eventscheduling.sdate) as eventschedulingdate 

ところで、ユーザー入力を SQL クエリに直接追加できるようにすることで、SQL インジェクションの脆弱性が発生します。

于 2013-03-11T15:35:56.930 に答える