Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
USE [Apartmentmanagementsystem]
GO
/****** Object:  StoredProcedure [dbo].[maintain]    Script Date: 6/16/2018 12:48:18 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[maintain]
@maintenance_id int,
@maintenance_date varchar(255),
@description varchar(255),
@Apt_id int
as 
if @maintenance_id=0
begin
insert into Maintenance
(maintenance_date,description,Apt_id) 
values( @maintenance_date,@description,@Apt_id )
end


don't know why this is not working

What I have tried:

tried this but nothing.not working at all
Posted
Comments
OriginalGriff 16-Jun-18 3:51am    
"It's not working" is one of the most useless problem descriptions we get: it tells us absolutely nothing about the problem. We don't know if you get an error message, or the wrong data, or even that that code compiles successfully!
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
So tell us what happens when you run that code, what you expected to happen, how you checked what happened. Help us to help you!
Use the "Improve question" widget to edit your question and provide better information.
[no name] 16-Jun-18 10:37am    
If you sent @maintenance_id as then it should add value in your table and looking at syntax it should work. If its not working which you skipped to mentioned here you have to rethink and rewrite this piece....
Mike V Baker 16-Jun-18 18:09pm    
Open your database in SSMS (Sql Server Management Studio). Right-click on the SP and choose 'Execute Stored Procedure'. Fill in the values in the dialogue as you would pass them in from the program and click 'OK'. The messages window will tell you wants wrong. One thing for certain, that you already suspect. You must have an Apt_id that already exists in the Apartment table. - assuming that's a FOREIGN KEY REFERENCES Apartments(Apt_id)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900