468,306 Members | 1,201 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

Error while passing input parameters to stored procedure using DAA

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
0 1283

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Leon Shaw | last post: by
4 posts views Thread by TJS | last post: by
3 posts views Thread by Adriano | last post: by
5 posts views Thread by csgraham74 | last post: by
1 post views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.