I have a SQL table like this:
ID
is Identity column.
And I have a class for this table in ASP.Net project like this:
public class Topic
{
public int ModuleID { get; set; }
public string Name { get; set; }
public string BodyHTML { get; set; }
}
Also I have a stored procedure:
ALTER PROCEDURE [dbo].[addTopic]
@Topic dbo.Topic READONLY
AS
BEGIN
insert into OnlineHelp_Topic
select * from @Topic
END
I want to pass a Topic
object from project and execute this stored procedure by SqlHelper.
I read many post like this and create a User-Defind Table
in SQL Server and I test this code:
Topic Topic = new Topic()
{
BodyHTML = "test body",
ModuleID = 1000,
Name = "test"
};
string constr = ConfigurationManager.ConnectionStrings["testConnection"].ConnectionString;
int rowsAffected = SqlHelper.ExecuteNonQuery(constr, "addTopic", new SqlParameter("@Topic", Topic));
But this code has error in SqlHelper.ExecuteNonQuery(...)
like this;
It would be very helpful if someone could explain solution for this problem.