I have a problem here where i cannot call stored procedure in DNN.I am using DNN 7[lastest].I tried using NamePrefix + "reg_user" but it appear not to call the procedure that I want.Below is what I tried but comes to the same result.
SqlDataProvider.cs[DAL]
public override void AddUser(int ModuleId,string User_name,string User_password,string User_email {
SqlHelper.ExecuteNonQuery(ConnectionString,GetFullyQualifiedName("reg_user"),ModuleId,User_name,User_password,User_email);
}
FeatureController.cs[BL]
Public void AddUser(Register_user reg){
if(reg._User_name.Trim() != "")
{
DataProvider.Instance().AddUser(reg.ModuleId,reg._User_name,reg.User_password,_User_email);
}
}
Register_user.cs[Entity]
public class Register_user
{
public int _ModuleId{ get; set; }
public string _User_name{ get; set; }
public string _User_password{ get; set; }
public string _User_email{ get; set; }
}
view.ascx.cs[UI]
protected void btnregister_Click(object sender, EventArgs e)
{
try
{
FeatureController cntrl = new FeatureController();
Register_user reg = new Register_user()
{
_ModuleId=ModuleId,
_User_name = txtusername.Text,
_User_email = txtemail.Text,
_User_password = txtpassword.Text
};
cntrl.AddUser(reg);
}
catch (Exception ee)
{
lblresult.Text = ee.Message.ToString();
}
}
Error: The store procedure 'dbo.DNNModule2_reg_user' doesn't exist.
Any helps are much appriciated!
I am back with solution update for this question that I asked few days ago. The solution for this is rather simple.Here is what i need to change.And it will call Sql database without any problem.
public override void AddUser(int ModuleId,string User_name,string User_password,string User_email {
SqlHelper.ExecuteNonQuery(ConnectionString,DatabaseOwner + ObjectQualifier + reg_user",ModuleId,User_name,User_password,User_email);
}
Just change from GetFullyQualifiedName to DatabaseOwner + ObjectQualifier. I am doing this as a part of good community members.So I tend not to left my question unanswered.
Regrads,