Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:52:23+00:00 2026-06-13T21:52:23+00:00

I have used the store procedure in MS-Sql for inserting for particular page it

  • 0

I have used the store procedure in MS-Sql for inserting for particular page it is working fine but I also need the same store procedure for other page it is finding me the error.

protected void btnsubmitt_Click(object sender, EventArgs e)
{
    ArrayList arParameters = ReturnParameter();
    DataSet dsInsertProfile = objadmin.GetGridData(arParameters,                    objconstant.sSP_INSERT_PROFILE);

    if (int.Parse(dsInsertProfile.Tables[0].Rows[0].ItemArray[0].ToString()) == 0)
    {
        pnlProfile.Visible = false;
        pnlThank.Visible = true;
        lblThank.Text = "Your profile have been successfully saved.";
    }

    else
    {
        lblThank.Text = "Your profile is not saved, please try again later.";
    }

}
public ArrayList ReturnParameter()
{
    Int64 email = Convert.ToInt64(txtemail.Text.ToString());
    ArrayList arSample = new ArrayList();
    Object[] c_email_id = new Object[3] { "@strEmailID", "varchar", email};
     arSample.Add(c_email_id);
     return arSample;
}
  public DataSet GetGridData(ArrayList dbArray, string sSpName)
    {
        DataSet dsDataSet = new DataSet();
        dsDataSet = datamanager.GetGridData(dbArray, sSpName);
        return dsDataSet;
    }
    public static DataSet GetGridData(ArrayList dbArray, string sSpName)
    {
        DataSet dsDataSet = new DataSet();
        SqlConnection cn = createConnection();
        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = sSpName;

        object objPrMtrName;
        object objSqlType;
        object objPrMtrVal;
        int i;
        for (i = 0; i < dbArray.Count; i++)
        {
            objPrMtrName = ((object[])(dbArray[i]))[0];
            objSqlType = ((object[])(dbArray[i]))[1];
            objPrMtrVal = ((object[])(dbArray[i]))[2];
            cmd.Parameters.Add(objPrMtrName.ToString(), GetSqlDataType(objSqlType.ToString())).Value = objPrMtrVal;
        }
        cmd.Connection = cn;
        try
        {
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            adp.Fill(dsDataSet);
            return dsDataSet;
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            cn.Close();
            cn.Dispose();
        }
    }

Mystore procedure

ALTER Procedure [dbo].[spInsert_profile]
(  @strEmailID varchar(200)

)
 AS
BEGIN
    DECLARE @intEmail INT
SET @intEmail = (SELECT COUNT(*) FROM gdt_Users WHERE [c_email_id]=@strEmailID)        
IF @intEmail = 0
 BEGIN

       Insert into gdt_Users([c_email_id],[d_modified_dttm],[d_created_dttm])values(@strEmailID,GETDATE(),GETDATE())

 SELECT @intEmail
  END
ELSE
    BEGIN
        SELECT @intEmail

    END
END

Here, I was facing a problem. It was throwing an exception

ERROR: Failed to convert parameter value from string to Int64 

So, I’ve add this code

Int64 email = Convert.ToInt64(txtemail.Text.ToString());

in arraylist returnparameter() method. Then, it threw that exception

ERROR: Input string was not in correct format

How can I solve this? Can you help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:52:24+00:00Added an answer on June 13, 2026 at 9:52 pm

    In your code I can find Convert.ToInt64 only at one place which is

    Int64 email = Convert.ToInt64(txtemail.Text.ToString());
    

    You would not be passing valid number to Convert.ToInt64( as txtemail will have string not a number. You should give a number in txtemail or use the correct textbox for converting the string to int64.

    Keep in mind Convert.ToInt64( converts string to number only if the
    string is number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used mysql stored procedure in php, but i need to return few
I have a JSON data store used for a combobox selection which is working
I've never used malloc to store more than values but I have to use
I have a working controller for another stored procedure in the database, but I
I have a stored procedure running in MS SQL 2008 R2 which runs fine
I created a stored procedure in SQL Server 2012 and I have used scope_identity
I have used LINQ to SQL with a update stored procedure to update databases
I have used this code to store Object to a file: try{ FileOutputStream saveFile=new
I have used localStorage[key] and key being different strings to store my values while
This is about asp.net mvc3 web application. We have used Object cache to store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.