救命呀
public int Add(Survey survey)
{ string cmdText = "insert into Survey (Address,Jiekuan,Work,Workplace,position,LoanBalance,LoanTerm,LoanWay,LoanKind,LoanUses,RepaymentDay,RepaymentWay,Contact,BasicInfo,OtherInfo,FinanceInfo) values(@Address,@Jiekuan,@Work,@Workplace,@position,@LoanBalance,@LoanTerm,@LoanWay,@LoanKind,@LoanUses,@RepaymentDay,@RepaymentWay,@Contact,@BasicInfo,@OtherInfo,@FinanceInfo )";
SqlParameter[] param =
//new SqlParameter[]
{ new SqlParameter("@Address",SqlDbType.NVarChar,100,survey.Address),
new SqlParameter("@Work",SqlDbType.NVarChar,100,survey.Work),
new SqlParameter("@Workplace",SqlDbType.NVarChar,100,survey.Workplace),
new SqlParameter("@Position",SqlDbType.NVarChar,100),
new SqlParameter("@LoanBlalance",SqlDbType.NVarChar,100),
new SqlParameter("@LoanTerm",SqlDbType.NVarChar,100),
new SqlParameter("@LoanWay",SqlDbType.NVarChar,100),
new SqlParameter("@LoanKind",SqlDbType.NVarChar,100),
new SqlParameter("@LoanUses",SqlDbType.NVarChar,100),
new SqlParameter("@RepaymentDay",SqlDbType.NVarChar,100),
new SqlParameter("@RepaymentWay",SqlDbType.NVarChar,100),
new SqlParameter("@Contact",SqlDbType.NVarChar,100),
new SqlParameter("@BasicInfo",SqlDbType.NVarChar,100),
new SqlParameter("@OtherInfo",SqlDbType.NVarChar,100),
new SqlParameter("@FinanceInfo",SqlDbType.NVarChar,100,survey.FinanceInfo)
};
param[0].Value = survey.Address;
param[1].Value = survey.Jiekuan;
param[2].Value = survey.Work;
param[3].Value = survey.Workplace;
param[4].Value = survey.position;
param[5].Value = survey.LoanBalance;
param[6].Value = survey.LoanTerm;
param[7].Value = survey.LoanWay;
param[8].Value = survey.LoanKind;
param[9].Value = survey.LoanUses;
param[10].Value = survey.RepaymentDay;
param[11].Value = survey.RepaymentWay;
param[12].Value = survey.Contact;
param[13].Value = survey.BasicInfo;
param[14].Value = survey.OtherInfo;
param[15].Value=survey.FinanceInfo;
SQLHelper.ExecuteNonQuery(SQLHelper.connString, CommandType.Text, cmdText, param);
return 0;
} /// <summary>
/// 得到一个对象实体
/// </summary> public void GetModel(string loanNum)
{
}
错误 4 当前上下文中不存在名称“SqlHelper” C:\Documents and Settings\Administrator\桌面\新建文件夹\SQLServerDal\SurveyDal.cs 64 13 SQLServerDal
public int Add(Survey survey)
{ string cmdText = "insert into Survey (Address,Jiekuan,Work,Workplace,position,LoanBalance,LoanTerm,LoanWay,LoanKind,LoanUses,RepaymentDay,RepaymentWay,Contact,BasicInfo,OtherInfo,FinanceInfo) values(@Address,@Jiekuan,@Work,@Workplace,@position,@LoanBalance,@LoanTerm,@LoanWay,@LoanKind,@LoanUses,@RepaymentDay,@RepaymentWay,@Contact,@BasicInfo,@OtherInfo,@FinanceInfo )";
SqlParameter[] param =
//new SqlParameter[]
{ new SqlParameter("@Address",SqlDbType.NVarChar,100,survey.Address),
new SqlParameter("@Work",SqlDbType.NVarChar,100,survey.Work),
new SqlParameter("@Workplace",SqlDbType.NVarChar,100,survey.Workplace),
new SqlParameter("@Position",SqlDbType.NVarChar,100),
new SqlParameter("@LoanBlalance",SqlDbType.NVarChar,100),
new SqlParameter("@LoanTerm",SqlDbType.NVarChar,100),
new SqlParameter("@LoanWay",SqlDbType.NVarChar,100),
new SqlParameter("@LoanKind",SqlDbType.NVarChar,100),
new SqlParameter("@LoanUses",SqlDbType.NVarChar,100),
new SqlParameter("@RepaymentDay",SqlDbType.NVarChar,100),
new SqlParameter("@RepaymentWay",SqlDbType.NVarChar,100),
new SqlParameter("@Contact",SqlDbType.NVarChar,100),
new SqlParameter("@BasicInfo",SqlDbType.NVarChar,100),
new SqlParameter("@OtherInfo",SqlDbType.NVarChar,100),
new SqlParameter("@FinanceInfo",SqlDbType.NVarChar,100,survey.FinanceInfo)
};
param[0].Value = survey.Address;
param[1].Value = survey.Jiekuan;
param[2].Value = survey.Work;
param[3].Value = survey.Workplace;
param[4].Value = survey.position;
param[5].Value = survey.LoanBalance;
param[6].Value = survey.LoanTerm;
param[7].Value = survey.LoanWay;
param[8].Value = survey.LoanKind;
param[9].Value = survey.LoanUses;
param[10].Value = survey.RepaymentDay;
param[11].Value = survey.RepaymentWay;
param[12].Value = survey.Contact;
param[13].Value = survey.BasicInfo;
param[14].Value = survey.OtherInfo;
param[15].Value=survey.FinanceInfo;
SQLHelper.ExecuteNonQuery(SQLHelper.connString, CommandType.Text, cmdText, param);
return 0;
} /// <summary>
/// 得到一个对象实体
/// </summary> public void GetModel(string loanNum)
{
}
错误 4 当前上下文中不存在名称“SqlHelper” C:\Documents and Settings\Administrator\桌面\新建文件夹\SQLServerDal\SurveyDal.cs 64 13 SQLServerDal
解决方案 »
- Gridview 翻页问题 出现javascript:__doPostBack( 'GridView1 ', 'Page$2 ')”。
- 看看为什么我的索引值为0
- 关于论坛显示数据的问题,请指点一下!
- 如何得到DataGrid中某列的宽度[在线等]
- 如何将数据库里image类型的数据显示成图像?
- 问个http request 问题
- 如何将"../a/web1.html"转换成http://www.baidu.com/a/web1.com将相对路径转换成绝对路径
- 各位老大,请问能不能用css控制textbox的maxlength属性?
- <%# 为会么的我<a href=deldir.aspx?dir=user/新建文件夹(3)> 在地址里显示的却是deldir.aspx?dir=user/新建文件夹 少了(3)
- 请教数据库连接问题
- 虚拟目录发布后,只能本机访问,为什么啊?
- google地图api中判断一个坐标是否位于一个多边形内
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Schema;有这个命名空间了吗?
using System.Collections.Generic;
using System.Text;
using IDAL;
using System.Data.SqlClient;
using System.Data;
using Model;
查看那你sqlhelper类的命名空间
在看看ExecuteNonQuery方法是否是静态方法
connString应该不是静态变量。。
你先实例化一个对象再调用其方法和属性(变量)。。SQLHelper sqlhelper=new SQLHelper();
sqlhelper.ExecuteNonQuery(sqlhelper.connString, CommandType.Text, cmdText, param);
using System;
using System.Collections.Generic;
using System.Text;
using IDAL;
using System.Data.SqlClient;
using System.Data;
using Model;
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Data.SqlClient;
using System.Xml;
using System.Xml.Schema;
看看petshop
dll在哪里???呃呃呃(⊙o⊙)…
晕
这个要你自己在你的目录里找,你直接问我们,帮不了你啊!因为这个文件是在你的项目中,并不是系统文件!
这个SqlHelper我确实用过,但是楼主你下载后
引用到项目中啊,这会吧,点右键添加引用,把下载的dll引进来
然后再using里面引入就可以了
好像是这: using Microsoft.ApplicationBlocks.Data;
试试加上using SQLServerDal;