本文介绍了我收到错误“在当前上下文中不存在名称'SqlHelper'”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用sp完成了sql中保存数据的代码
i完成了后续课程
i have done th code for save data in sql using sp
i have done the folling class
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data.Sql;
/// <summary>
/// Summary description for infoaddup
/// </summary>
public class infoaddup
{
infoaddup objinfo = new infoaddup();
int Id;
public int id
{
get { return Id; }
set { Id = value; }
}
string Name;
public string name
{
get { return Name; }
set { Name = value; }
}
string Last_Name;
public string last_Name
{
get { return Last_Name; }
set { Last_Name = value; }
}
string Ph;
public string ph
{
get { return Ph; }
set { Ph = value; }
}
public infoaddup()
{
try
{
SqlParameter[] p = new SqlParameter[4];
p[0] = new SqlParameter("@Id", SqlDbType.Int);
p[0].Value = Id;
p[1] = new SqlParameter("@Name", SqlDbType.NVarChar);
p[1].Value = Name;
p[2] = new SqlParameter("@Last_Name", SqlDbType.NVarChar);
p[2].Value = Last_Name;
p[3] = new SqlParameter("@Ph", SqlDbType.NVarChar);
p[3].Value = Ph;
// int i = SqlHelper.ExecuteNonQuery(clsConnection.ConnectionString, CommandType.StoredProcedure, "ConsineeMaster_AddUpdate", p);
int i = SqlHelper.ExecuteNonQuery(infoaddup.ConnectionString, CommandType.StoredProcedure, "infoaddup", p);
}
catch (Exception ex)
{
clsErrHandler.WriteError(ex);
}
}
}
推荐答案
这篇关于我收到错误“在当前上下文中不存在名称'SqlHelper'”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!