'Microsoft.ApplicationBlocks.Data.SqlHelper.SqlHelper()' is inaccessible due to its protection level
code is
public
static void AddReview(Review r)
{
Microsoft.ApplicationBlocks.Data.SqlHelper objSqlHelper =
new SqlHelper();
SqlParameter[] objParams =
new SqlParameter[5];
objParams[0] = new
SqlParameter("@productid", r.ProductId);
objParams[1] =
new
SqlParameter("@username", r.UserName);
objParams[2] = new
SqlParameter("@email", r.Email);
objParams[3] =
new
SqlParameter("@rating", r.Rating);
objParams[4] = new
SqlParameter("@comments", r.Comments);
Member
1 Points
38 Posts
Access error sqlhelper
Mar 26, 2008 02:46 PM|Kalloo|LINK
Please can any one help me in this error
'Microsoft.ApplicationBlocks.Data.SqlHelper.SqlHelper()' is inaccessible due to its protection level
code is
public static void AddReview(Review r){
Microsoft.ApplicationBlocks.Data.SqlHelper objSqlHelper = new SqlHelper(); SqlParameter[] objParams = new SqlParameter[5]; objParams[0] = new SqlParameter("@productid", r.ProductId);objParams[1] =
new SqlParameter("@username", r.UserName); objParams[2] = new SqlParameter("@email", r.Email);objParams[3] =
new SqlParameter("@rating", r.Rating); objParams[4] = new SqlParameter("@comments", r.Comments);objSqlHelper.ExecuteNonQuery(
"AddReview", objParams);}
All-Star
69278 Points
7977 Posts
Moderator
Re: Access error sqlhelper
Mar 26, 2008 07:54 PM|anas|LINK
HI
you don't need to create an instance of the SQLHelper, instead you can access its static(shared) function directliy by class name
but maybe that is not the problem, it seems its a trust problem ,
note that the SQLHelper Needs a medium trust application Level (which is the Default for asp.NET)
Did you changed the Trust level from your website web.config file ?