Error while passing input parameters to stored procedure using DAA

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlrZQ==?=, Jun 22, 2005.

  1. Hi,
    I am trying to insert parameters into a stored procedure using DAAB (see
    code at the bottom of this post). I am getting the following error:
    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information about
    the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set
    to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web
    request. Information regarding the origin and location of the exception can
    be identified using the exception stack trace below.

    Stack Trace:


    [NullReferenceException: Object reference not set to an instance of an
    object.]
    Microsoft.ApplicationBlocks.Data.SqlHelper.AttachParameters(SqlCommand
    command, SqlParameter[] commandParameters)
    Microsoft.ApplicationBlocks.Data.SqlHelper.PrepareCommand(SqlCommand
    command, SqlConnection connection, SqlTransaction transaction, CommandType
    commandType, String commandText, SqlParameter[] commandParameters)
    Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection
    connection, CommandType commandType, String commandText, SqlParameter[]
    commandParameters)
    Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String
    connectionString, CommandType commandType, String commandText, SqlParameter[]
    commandParameters)


    Code:



    Dim Params As SqlParameter() = New SqlParameter(2) {}
    Params(0) = New SqlParameter("@title", SqlDbType.VarChar)
    Params(0).Value = AdoFunc.FixTick(txtTitle.Text)
    Params(1) = New SqlParameter("@body", SqlDbType.VarChar)
    Params(1).Value = AdoFunc.FixTick(txtBody.Text)


    SqlHelper.ExecuteNonQuery(AppSettings.Get("myconnection"),
    CommandType.StoredProcedure, "insert_data", Params)

    Stored procedure:
    CREATE PROCEDURE insert_data
    (
    @title as varchar(100),
    @body as varchar(600)

    )
    AS

    insert into motivation_products(title,body) values('@title','@body')
    =?Utf-8?B?TWlrZQ==?=, Jun 22, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kavitha N via .NET 247

    passing parameters to stored procedure from crystal reports

    kavitha N via .NET 247, Jun 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    10,803
    galahad
    Feb 15, 2011
  2. =?Utf-8?B?SmltbXk=?=
    Replies:
    0
    Views:
    1,776
    =?Utf-8?B?SmltbXk=?=
    Sep 9, 2005
  3. ABC
    Replies:
    3
    Views:
    5,209
    Steve C. Orr [MVP, MCSD]
    Mar 29, 2006
  4. JM
    Replies:
    3
    Views:
    915
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 13, 2007
  5. Hermes
    Replies:
    1
    Views:
    169
    Bob Barrows [MVP]
    Sep 12, 2004
Loading...

Share This Page