Click here to Skip to main content
15,899,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i've a table in my Database where i'm saving the attendance the of teachers

where columns are given as

Teacher_ID , Date , Arrival_time , Departure_time


teacherID and date are working as composite key
but data is not inserting here
it is giving exception that it has no primary key
Posted
Comments
Sampath Lokuge 16-Feb-14 2:14am    
Have you declared a primary key on you db table ?
Ammar Shaukat 16-Feb-14 13:40pm    
no
khurram ali lashari 16-Feb-14 6:40am    
try to used stored procedure
Ammar Shaukat 16-Feb-14 13:40pm    
hmmm
Ammar Shaukat 16-Feb-14 22:06pm    
Store procedures are look tough.. i don't know how to use them in linq

1 solution

SQL
 CREATE PROCEDURE [dbo].[Sp_Add_MENUS]--[Sp_Add_MENUS] is the name of Stored Procedure
	--Declare Below Your Columns 
	@MenuName AS NVARCHAR(50),
	@PareId		AS int,
	@FrmId AS NVARCHAR(50),
	@COMMENTS AS NVARCHAR(100),
	@IsReadOnly AS varchar,
	@IsVisible		AS VARCHAR(1),
	@RESULT AS NVARCHAR(50) OUTPUT
AS
BEGIN
	
    -- Insert statements for procedure here
	INSERT INTO TBLCFGMENUS(MenuName,PareId,FrmId,IsReadOnly,IsVisible,Comments) 
	VALUES (@MenuName,@PareId,@FrmId ,@IsReadOnly,@IsVisible,@COMMENTS)
	
	SET @Result = N'Data Inserted Succssfuly'
END
 
Share this answer
 

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