Click here to Skip to main content
15,886,570 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have written the stored procedure like this-----------
SQL
ALTER PROCEDURE dbo.Sp_clientinsert
	
	(
	@clint varchar(5),
	@clinm varchar(20),
	@cont1 varchar(10),
	@cont2 varchar(10),
	@pradd varchar(MAX),
	@lcadd varchar(MAX),
	@email varchar(50),
	@ccity varchar(20),
	@thsil varchar(20),
	@distr varchar(20),
	@state varchar(20),
	@con	varchar(20),
	@pin   numeric(10),
    @conpr varchar(50),
	@branm varchar(20),
	@cladd date ,
	@clldt date,
	@clilt time

	)
	
AS 
insert into CLNT values 
(@clint,@clinm,	@cont1,	@cont2,@pradd,@lcadd,@email,@ccity,@thsil,@distr,@state,@con,@pin,@conpr,@branm ,@cladd,@clldt,@clilt)
	
	RETURN

My .cs file contains following code
C#
public int ClientDetails()
    {
        SqlCommand command = new SqlCommand("Sp_clientinsert", connectionmanager.GetConnection());
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add(new SqlParameter("@clint", Client));
        command.Parameters.Add (new SqlParameter("@clinm",ClientName ));
        command.Parameters.Add(new SqlParameter("@cont1",Contact1));
        command.Parameters.Add(new SqlParameter("@cont2 ",Contact2 ));

        command.Parameters.Add(new SqlParameter("@pradd",ParmanentAdd ));
        command.Parameters.Add(new SqlParameter("@lcadd", LocalAdd));
        command.Parameters.Add(new SqlParameter("@email ",Email ));
        command.Parameters.Add(new SqlParameter("@ccity",ClientCity ));
        command.Parameters.Add(new SqlParameter("@thsil", Thesil));
        command.Parameters.Add(new SqlParameter("@distr", district));
        command.Parameters.Add(new SqlParameter("@state", state));
        command.Parameters.Add(new SqlParameter("@con", Country));
        command.Parameters.Add(new SqlParameter("@pin", PinCode.ToString()));
        command.Parameters.Add(new SqlParameter("@conpr", ContactPerson));
        command.Parameters.Add(new SqlParameter("@branm ", Branch));
       

        command.Parameters.Add(new SqlParameter("@cladd", CActiveDate ));
      
        command.Parameters.Add(new SqlParameter("@clldt", CLastLoginDate ));
        command.Parameters.Add(new SqlParameter("@clilt", CLogintime.ToString()));
        int i = command.ExecuteNonQuery();
        return i;
    }
Posted
Updated 22-Oct-13 0:27am
v2
Comments
Thanks7872 22-Oct-13 6:41am    
And? We are suppose to assume the rest,right?
Nandakishore G N 22-Oct-13 6:56am    
check pincode and date are in format are not.But please, paste the code completely what you have done till now and explain some more.
ZurdoDev 22-Oct-13 7:44am    
What's your question? The error is clear.
Mike Meinz 22-Oct-13 14:24pm    
Are the variables CActiveDate, CLastLoginDate and CLogintime DATE Data Types?

If not, cast them as DATE Data Types when passing them to SqlParameter.

Also, it is a best practice to not use "sp" to prefix the name of your stored procedures. Microsoft uses "sp" to prefix the name of the built-in stored procedures. To avoid a conflict now or in the future, use some other prefix other than "sp".

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