using System;
using System.Collections.Generic;
using System.Text;
using IDAL;
using System.Data.SqlClient;
using System.Data;
using Model;
using System.Configuration;
using System.Web;
using System.Xml;
using System.Xml.Schema;using DBUtility;namespace SQLServerDal
{
public class SurveyDal : ISurvey
{ /// <summary>
/// 增加一条数据
/// </summary>
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 )";
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into Survey(Address) values (@Address)");
strSql.Append("Address");
strSql.Append(" values (");
strSql.Append("@Address)");
strSql.Append(";select @@IDENTITY");
SqlParameter[] param =
//new SqlParameter[]
{
new SqlParameter("@Address",SqlDbType.NVarChar,100),
new SqlParameter("@Work",SqlDbType.NVarChar,100),
//new SqlParameter("@Workplace",SqlDbType.NVarChar,100),
//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)
};
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 sqlhelper = new SQLHelper();
object obj = SQLHelper.ExecuteNonQuery(SQLHelper.connString, CommandType.Text, strSql.ToString(), param);
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
}
//Opinion text, ----审核意见
//opinionDay datetime ----审核日期
} /// <summary>
/// 得到一个对象实体
/// </summary>
public void GetModel(string loanNum)
{
} }
}现在不能插入
刚刚可以插入
但是不论我怎么改 都是只能插入 address
好神奇呀
大家帮我看看那里出错了 麻烦各位了
using System.Collections.Generic;
using System.Text;
using IDAL;
using System.Data.SqlClient;
using System.Data;
using Model;
using System.Configuration;
using System.Web;
using System.Xml;
using System.Xml.Schema;using DBUtility;namespace SQLServerDal
{
public class SurveyDal : ISurvey
{ /// <summary>
/// 增加一条数据
/// </summary>
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 )";
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into Survey(Address) values (@Address)");
strSql.Append("Address");
strSql.Append(" values (");
strSql.Append("@Address)");
strSql.Append(";select @@IDENTITY");
SqlParameter[] param =
//new SqlParameter[]
{
new SqlParameter("@Address",SqlDbType.NVarChar,100),
new SqlParameter("@Work",SqlDbType.NVarChar,100),
//new SqlParameter("@Workplace",SqlDbType.NVarChar,100),
//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)
};
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 sqlhelper = new SQLHelper();
object obj = SQLHelper.ExecuteNonQuery(SQLHelper.connString, CommandType.Text, strSql.ToString(), param);
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
}
//Opinion text, ----审核意见
//opinionDay datetime ----审核日期
} /// <summary>
/// 得到一个对象实体
/// </summary>
public void GetModel(string loanNum)
{
} }
}现在不能插入
刚刚可以插入
但是不论我怎么改 都是只能插入 address
好神奇呀
大家帮我看看那里出错了 麻烦各位了
解决方案 »
- vs2010中,如何引用web.config中的数据库连接字符串
- localhost!=本机的IP吗?
- Exchange邮箱的收件人类型问题??
- 向各位大侠请教httpmodule的使用
- formview datalist repeater 控件使用区别是什么?
- 问一个DATALIST绑定的问题。有明白的进来看下,解决了马上给分
- 快下班了,给大家出个简单点的题目做做
- A页有一Datagrid,从A页中打开B页进行修改,提交后关闭B页,返回A页并刷新当前的Datagrid,
- 高分求贴:关于TREEVIEW控件的子节点的问题
- VS.NET 2003 beta已经有了,哪里有的下?
- 后台动态添加TEXTBOX 取值问题
- 网站发布问题--今天结贴
太长了。。看不清
[/Quot]
顶
using System.Collections.Generic;
using System.Text;
using IDAL;
using System.Data.SqlClient;
using System.Data;
using Model;
using System.Configuration;
using System.Web;
using System.Xml;
using System.Xml.Schema; using DBUtility; namespace SQLServerDal
{
public class SurveyDal : ISurvey
{ /// <summary>
/// 增加一条数据
/// </summary>
public int Add(Survey survey)
{ StringBuilder strSql = new StringBuilder();
strSql.Append("insert into Survey(Address) values (@Address)");
strSql.Append("Address");
strSql.Append(" values (");
strSql.Append("@Address)");
strSql.Append(";select @@IDENTITY");
SqlParameter[] param =
//new SqlParameter[]
{
new SqlParameter("@Address",SqlDbType.NVarChar,100),
new SqlParameter("@Work",SqlDbType.NVarChar,100),
};
param[0].Value = survey.Address;
param[2].Value = survey.Work;
object obj = SQLHelper.ExecuteNonQuery(SQLHelper.connString, CommandType.Text, strSql.ToString(), param);
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
} } /// <summary>
/// 得到一个对象实体
/// </summary>
//param[1].Value = survey.Jiekuan;
param[2].Value = survey.Work;
strSql.Append("insert into Survey(Address) values (@Address)");
strSql.Append("Address");
strSql.Append(" values (");
strSql.Append("@Address)");
strSql.Append(";select @@IDENTITY"); 红色标明的地方