By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,705 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,705 IT Pros & Developers. It's quick & easy.

Error while passing input parameters to stored procedure using DAA

P: n/a
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.AttachP arameters(SqlCommand
command, SqlParameter[] commandParameters)
Microsoft.ApplicationBlocks.Data.SqlHelper.Prepare Command(SqlCommand
command, SqlConnection connection, SqlTransaction transaction, CommandType
commandType, String commandText, SqlParameter[] commandParameters)
Microsoft.ApplicationBlocks.Data.SqlHelper.Execute NonQuery(SqlConnection
connection, CommandType commandType, String commandText, SqlParameter[]
commandParameters)
Microsoft.ApplicationBlocks.Data.SqlHelper.Execute NonQuery(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("myconne ction"),
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')
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.