Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My store Procedure :-

SQL
ALTER PROCEDURE [dbo].[tblScriptInsert]
	-- Add the parameters for the stored procedure here
	 @ScriptId int 
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	 INSERT INTO [dbo].[tblScript] ([ScriptId])
       SELECT @ScriptId
       INSERT INTO [dbo].[tbl_clientcolumnnames] ([ScriptId])
       SELECT @ScriptId
       INSERT INTO [dbo].[tbl_Intellectcolumnnames] ([ScriptId])
       SELECT @ScriptId
END

My c# code but not insert any thing and nooo error pls help us if any thing wrong in my code pls let me know.
C#
globalScriptid = ScriptId.ToString();
                   SqlCommand cmd4 = new SqlCommand("tblScriptInsert", connection);
                   cmd4.Parameters.Add(" @ScriptId", SqlDbType.Int).Value = globalScriptid.ToString();
                   cmd4.CommandType = CommandType.StoredProcedure;
Posted

insert into table(column_name) values(@ScriptId)
 
Share this answer
 
Hi Hareesh

i am done change in stored procedure but still data not inset
 
Share this answer
 
C#
globalScriptid = ScriptId.ToString();
                    SqlParameter parameter = null;
                    SqlCommand cmd4 = new SqlCommand("tblScriptInsert", connection);
                    cmd4.CommandType = CommandType.StoredProcedure;
                    cmd4.Parameters.Add(new SqlParameter ("@ScriptId", SqlDbType.Int)).Value = globalScriptid.ToString();
                    cmd4.Parameters.Add(parameter);
                    cmd4.ExecuteNonQuery();


i am done this changed know data insert in 3 table thank you to all your valuable time
 
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