it gives error while calling a sql stored procedure as "INPUT STRING WAS NOT IN A CORRECT FORMAT". I am providing the code here.
publicvoid get_issid(string cse_email,string tech_email,string subject,string issue_details,string response,string solv_date,outint issid){
// Establish Connection
SqlConnection oConnection = GetConnection();// build the command
SqlCommand oCommand =newSqlCommand("get_issid", oConnection);oCommand.CommandType =CommandType.StoredProcedure;
// Parameters
SqlParameter paracse_email =newSqlParameter("@.cse_email",SqlDbType.VarChar, 50);paracse_email.Value =cse_email;
oCommand.Parameters.Add(paracse_email);
SqlParameter paratech_email =newSqlParameter("@.tech_email",SqlDbType.VarChar,50);
paratech_email.Value = cse_email;
oCommand.Parameters.Add(paratech_email);
SqlParameter parasubject =newSqlParameter("@.subject",SqlDbType.VarChar, 50);parasubject.Value = subject;
oCommand.Parameters.Add(parasubject);
SqlParameter paraissue_details =newSqlParameter("@.issue_details",SqlDbType.VarChar, 500);paraissue_details.Value = issue_details;
oCommand.Parameters.Add(paraissue_details);
SqlParameter pararesponse =newSqlParameter("@.response",SqlDbType.VarChar, 500);pararesponse.Value = response;
oCommand.Parameters.Add(pararesponse);
SqlParameter parasolv_date =newSqlParameter("@.solv_date",SqlDbType.DateTime);parasolv_date.Value = solv_date;
oCommand.Parameters.Add(parasolv_date);
SqlParameter paraissid =newSqlParameter("@.issid",SqlDbType.Int);paraissid.Direction =ParameterDirection.Output;oCommand.Parameters.Add(paraissid);
try
{
oConnection.Open();
oCommand.ExecuteNonQuery();
issid =int.Parse(paraissid.Value.ToString());}
catch (Exception oException){
throw oException;}
finally
{
oConnection.Close();
}
}
the stored procedure is:
create proc [dbo].[get_issid](@.tech_emailvarchar(50), @.cse_emailvarchar(50),@.subjectvarchar(50),@.issue_detailsvarchar(500),@.responsevarchar(500),@.solv_datedatetime, @.issidintoutput)
as
select @.issid=tech_response.issue_idfrom tech_response,issue_detailswhere tech_response.tech_email=@.tech_emailand tech_response.cse_email=@.cse_emailand tech_response.subject=@.subjectand tech_response.issue_details=@.issue_detailsand response=@.responseand solv_date=@.solv_dateand tech_response.issue_id=issue_details.issue_id
requested to help in this
Use ExecuteScalar or ExecuteReader .
ExecuteNonQuery can be used only on DDL statements such as Insert and Delete statements.
Hi,
Thank u for your reply. but the error is coming again same as earlier.
pls help me in this regard.
your amibly,
nagireddy
No comments:
Post a Comment