Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Updating a table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-18 : 09:19:50
Teri writes "I have written a query to allow students to make appointments on my website. The query works, but there is a problem.

SQLStmt = "UPDATE Week1 "
SQLStmt = SQLStmt & "SET LastName='" & Form_Last_Name & "',"
SQLStmt = SQLStmt & "StudentID='" & Form_Student_ID & "',"
SQLStmt = SQLStmt & "CourseCode='" & Form_Course_Code & "' "
SQLStmt = SQLStmt & "WHERE TimeSlotID='" & Form_TimeSlot & "' AND Tutor='" & Form_Tutor & "'"

When the students fill out the form to make the appointment, if they inadvertently pick a TimeSlot and tutor that aren't matched
(in the same row of the table), the query still runs as if the appointment had been made. How can I get it to only update the table when
the TimeSlot and tutor are in the same row of the table?"

Nazim
A custom title

1408 Posts

Posted - 2002-06-18 : 09:25:04
i think your query looks fine. Copy and paste your complete SQLStmt in Query analyzer and check.


i would suggest you to write a stored procedure rather then doing it this way.

if you need more help , tell us.



-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson
Go to Top of Page
   

- Advertisement -