NHibernate 之 “ 值“System.Object[]”不是“”类型,不能在此泛型集合中使用。 参数名: value”

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/ArvinStudy/article/details/7658187

        public IList<OutStorageDataView> GetItemList(int Brand_ID, int pageNo, int pageSize, out int TotalNumber)
        {                       
            IList<OutStorageDataView> List;
            ICriteria critRecordCount = NHibernateSessionReader.CreateCriteria(typeof(OutStorageDataView));          
            //查询总数(未入数据)
            TotalNumber = Convert.ToInt32(critRecordCount.SetProjection(Projections.Count("Item_ID")).UniqueResult());
            ////获得当前页的数据
            //ICriteria crit = NHibernateSessionReader.CreateCriteria(typeof(OutStorageDataView));
            //crit.Add(Restrictions.Eq("Brand_ID", Brand_ID));
            //crit.SetFirstResult((pageNo - 1) * pageSize)
            //                   .SetMaxResults(pageSize);
            //List = crit.List<OutStorageDataView>();
            //return List;
            //------------
            IQuery crit = NHibernateSessionReader.CreateSQLQuery("SELECT [Item_ID],[Item_Title],[Item_URL],[SearchEngine_Name],[Task_KeyWord],[Brand_Name],[Item_SDate],[Item_CDate],[Admin_Name],[Brand_ID] FROM [OutStorageDataView]");
            
            //crit.Add(Restrictions.Eq("Brand_ID", Brand_ID));
            crit.SetFirstResult((pageNo - 1) * pageSize)
                               .SetMaxResults(pageSize);
            //List = (List<OutStorageDataView>)crit.List<OutStorageDataView>();
            List = crit.List<OutStorageDataView>();
            return List;
        }

        #endregion
    }


报错:

值“System.Object[]”不是“IWOMTracker.Data.Model.OutStorageDataView”类型,不能在此泛型集合中使用。

参数名: value

修正:

List = crit.List<OutStorageDataView>();
因为默认返回的数值类型是System.Object[] 不不是“IWOMTracker.Data.Model.OutStorageDataView”类型

改成:

IQuery crit = NHibernateSessionReader.CreateSQLQuery("SELECT [Item_ID],[Item_Title],[Item_URL],[SearchEngine_Name],[Task_KeyWord],[Brand_Name],[Item_SDate],[Item_CDate],[Admin_Name],[Brand_ID] FROM [OutStorageDataView]", "t", typeof(OutStorageDataView));
            //crit.Add(Restrictions.Eq("Brand_ID", Brand_ID));
            crit.SetFirstResult((pageNo - 1) * pageSize)
                               .SetMaxResults(pageSize);
            List = (List<OutStorageDataView>)(crit.List<OutStorageDataView>());
            return List;

进行强类型转换,就OK了。

展开阅读全文

SqlParameterCollection 只接受非空的 SqlParameter 类型对象。 参数名: value

06-19

我是个菜鸟,请各位大哥帮帮忙帮我看看,小妹不胜感激rn代码:rnrnrn/// rn/// DBOperate 的摘要说明rn/// rnpublic class DBOperaternrn public DBOperate()rn rn //rn // TODO: 在此处添加构造函数逻辑rn //rn rn private SqlConnection conn=null;rn private SqlCommand cmd=null;rn private SqlDataReader dr = null;rn private SqlDataAdapter adp = null;rn private DataSet ds = null;rn private DataTable dt = null;rnrn //connect dbrn public SqlConnection DBConnection()rn rn conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BookShopConnectionString"].ConnectionString);rn return conn;rn rn //close db , dispose resourcesrn public void DBClose()rn rn if (conn.State == ConnectionState.Open)rn rn conn.Close();rn conn.Dispose();rn rn rn //create commandrn public SqlCommand createCommand(string str, CommandType cmdType)rn rn cmd = new SqlCommand();rn cmd.Connection = DBConnection();rn cmd.CommandText = str;rn cmd.CommandType = cmdType;rn return cmd;rn rn //create command with sqlParametersrn public SqlCommand createCommand(string str, CommandType cmdType, SqlParameter[] param)rn rn cmd = new SqlCommand();rn cmd.Connection = DBConnection();rn cmd.CommandText = str;rn cmd.CommandType = cmdType;rn foreach (SqlParameter par in param)rn rn cmd.Parameters.Add(par);rn rn return cmd;rn rn //execute dataReaderrn public SqlDataReader executeReader(string str, CommandType cmdType)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType);rn dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); //if transfers dr.Close(), then will also transfer conn.Close()rn rn catch (Exception ee)rn rn throw ee;rn rn return dr;rn rn //execute dataReader with sqlParametersrn public SqlDataReader executeReader(string str, CommandType cmdType, SqlParameter [] param)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType, param);rn dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); //if transfers dr.Close(), then will also transfer conn.Close()rn rn catch (Exception ee)rn rn throw ee;rn rn return dr;rn rn //execute dataSetrn public DataSet executeDataSet(string str, CommandType cmdType)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType);rn adp = new SqlDataAdapter(cmd);rn ds = new DataSet();rn adp.Fill(ds);rn rn catch (Exception ee)rn rn throw ee;rn rn finallyrn rn conn.Close();rn rn return ds;rn rn //execute dataSet with sqlParametersrn public DataSet executeDataSet(string str, CommandType cmdType, SqlParameter [] param)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType, param);rn adp = new SqlDataAdapter(cmd);rn ds = new DataSet();rn adp.Fill(ds);rn rn catch (Exception ee)rn rn throw ee;rn rn finallyrn rn conn.Close();rn rn return ds;rn rn //execute datatablern public DataTable executeDataTable(string str, CommandType cmdType)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType);rn adp = new SqlDataAdapter(cmd);rn ds = new DataSet();rn adp.Fill(ds);rn dt = ds.Tables[0];rn rn catch (Exception ee)rn rn throw ee;rn rn finallyrn rn conn.Close();rn rn return dt;rn rn //execute datatable with sqlParametersrn public DataTable executeDataTable(string str, CommandType cmdType, SqlParameter [] param)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType,param);rn adp = new SqlDataAdapter(cmd);rn ds = new DataSet();rn adp.Fill(ds);rn dt = ds.Tables[0];rn rn catch (Exception ee)rn rn throw ee;rn rn finallyrn rn conn.Close();rn rn return dt;rn rn rn //execute nonQueryrn public void executeNonQuery(string str, CommandType cmdType)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType);rn conn.Open();rn cmd.ExecuteNonQuery();rn rn catch (Exception ee)rn rn throw ee;rn rn finallyrn rn conn.Close();rn rn rn //execute nonQuery with sqlParametersrn public void executeNonQuery(string str, CommandType cmdType, SqlParameter [] param)rn rn conn = DBConnection();rn tryrn rn conn.Open();rn cmd = createCommand(str, cmdType,param);rn conn.Open();rn cmd.ExecuteNonQuery();rn rn catch (Exception ee)rn rn throw ee;rn rn finallyrn rn conn.Close();rn rn rnrn 论坛

异常详细信息: System.ArgumentNullException: 值不能为 null。 参数名: value

06-10

“/”应用程序中的服务器错误。rnrn值不能为 null。rn参数名: valuernrn说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.ArgumentNullException: 值不能为 null。rn参数名: valuernrn源错误: rnrn执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。rnrn堆栈跟踪: rnrnrn[ArgumentNullException: 值不能为 null。rn参数名: value]rn System.ComponentModel.DataAnnotations.ValidationContext.set_DisplayName(String value) +50543rn System.Web.Mvc.d__1.MoveNext() +130rn System.Web.Mvc.d__5.MoveNext() +311rn System.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) +136rn System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +66rn System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +1314rn System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +411rn System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +317rn System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +117rn System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324rn System.Web.Mvc.Controller.ExecuteCore() +106rn System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91rn System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10rn System.Web.Mvc.<>c__DisplayClassb.b__5() +34rn System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +19rn System.Web.Mvc.Async.<>c__DisplayClass8`1.b__7(IAsyncResult _) +10rn System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62rn System.Web.Mvc.<>c__DisplayClasse.b__d() +48rn System.Web.Mvc.SecurityUtil.b__0(Action f) +7rn System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22rn System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60rn System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9rn System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708rn System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155rnrnrnrnrn[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/4.gif][/img]网上找遍了方法 都没用 求助到底哪里出错了 所有字段都可以为空 而且断点根本不跳到 Controller对应的方法里面 论坛

【求救!】伪静态报错 值不能为null。参数名value

09-24

新建的是网站。不是新建项目。不知道这和问题有没关系。rn伪静态之前访问正常。rn使用URLRewrite伪静态不成功。报这个莫名其妙的错。(URLRewrite已经引用。文件也在BIN目录中)rn我访问的是DEFAULT.HTML。伪静态到DEFAULT.ASPXrn现在HTML和ASPX访问都是报这个错。rn这个页面不需要任何参数。只是从数据库读几条记录显示出来。rn不知道伪静态配置是不是错了。rnrn报错信息:rn[code=csharp]rn“/”应用程序中的服务器错误。rnrn值不能为 null。rn参数名: valuernrn说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.ArgumentNullException: 值不能为 null。rn参数名: valuernrn源错误: rnrn执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。rnrn堆栈跟踪: rnrnrn[ArgumentNullException: 值不能为 null。rn参数名: value]rn System.Web.Caching.CacheEntry..ctor(String key, Object value, CacheDependency dependency, CacheItemRemovedCallback onRemovedHandler, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, Boolean isPublic) +8961263rn System.Web.Caching.CacheInternal.DoInsert(Boolean isPublic, String key, Object value, CacheDependency dependencies, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback, Boolean replace) +93rn System.Web.Caching.Cache.Insert(String key, Object value) +75rn URLRewriter.Config.RewriterConfiguration.GetConfig() +130rn URLRewriter.ModuleRewriter.Rewrite(String requestedPath, HttpApplication app) +107rn URLRewriter.BaseModuleRewriter.BaseModuleRewriter_AuthorizeRequest(Object sender, EventArgs e) +122rn System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148rn System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75rn[/code]rnrnrn伪静态WEB.CONFIGrn[code=csharp]rnrnrnrn rn rn rn rn rn rn rn rnrnrn rn rn rn rn rnrn[/code] 论坛

不能为空。参数名: dataSet ???

10-20

public class WebForm1 : System.Web.UI.Page rn rn protected System.Web.UI.WebControls.Label Label1; rn rn protected System.Web.UI.WebControls.DataGrid DataGrid2; rn rn OleDbConnection sqlcon1=new OleDbConnection(ConfigurationSettings.AppSettings.Get("NWindOle")); rn rn public DataSet ds1; rn rn private void Page_Load(object sender, System.EventArgs e) rn rn rn if(!IsPostBack) rn rn OleDbDataAdapter oadp1=new OleDbDataAdapter("select lastname,employeeid from employees",sqlcon1); rn rn oadp1.Fill(ds1,"shankai"); rn DataView dv1=new DataView(ds1.Tables[0]); rn Label1.Text=dv1.Count.ToString(); rn DataGrid2.DataSource=dv1; rn DataGrid2.DataBind(); rn rn rn rn rn // 在此处放置用户代码以初始化页面 rn rnrn #region Web 窗体设计器生成的代码 rn override protected void OnInit(EventArgs e) rn rn // rn // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 rn // rn InitializeComponent(); rn base.OnInit(e); rn rn rn /// rn /// 设计器支持所需的方法 - 不要使用代码编辑器修改 rn /// 此方法的内容。 rn /// rn private void InitializeComponent() rn rn this.DataGrid2.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DataGrid2_SortCommand); rn this.Load += new System.EventHandler(this.Page_Load); rnrn rn #endregion rnrn private void DataGrid2_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) rn rn DataGrid2.DataSource=ds1.Tables[0]; rn DataGrid2.DataBind(); rnrn rn rnrnrnrn是变量范围出问题了吗,怎么定义全局变量,怎么保存上面的Tables[0]不消失 论坛

不能为空 参数名:commandText

12-18

这段代码实现功能:从dReader中取数批量插入表里,某条数据插入时判断是否在表中已存在,不存在才插入rn已知主键值肯定不为空,传入的参数肯定有值rn求解为什么会报错 值不能为空 参数名:commandTextrn[code=C#]rnpublic virtual int InsertDataReader(IDataReader dReader, string TableName, int batchRow)rn rn DataTable dt = dReader.GetSchemaTable();rn StringBuilder sb = new StringBuilder();rnrn //取得插入表主键 rn var keysql = @"SELECT COLUMN_NAME rn FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGErn WHERE TABLE_NAME='0'";rn keysql = String.Format(keysql, TableName);rn var key = "";rn var keylocation = -1;rn var value = "";rn if (m_targetDbType == DataBaseType.SqlServe)rn key = SqlDB.ExecuteScalar(this.m_targetStr, keysql).ToString();rnrn int ret = 0;rn //标志,用来计数rn int flag = 0;rn string strSql = "";rn while (dReader.Read())rn rn flag = flag + 1;rnrn // 生成字段(仅生成一次)rn if (strSql == "")rn rn strSql = @" Insert Into " + TableName + " (";rn StringBuilder sbKey = new StringBuilder();rn for (int i = 0; i < dReader.FieldCount; i++)rn rn //取主键的索引rn if (m_targetDbType == DataBaseType.SqlServe && dt.Rows[i][0].ToString() == key)rn keylocation = i;rn sbKey.Append(dt.Rows[i][0].ToString() + ",");rn rn sbKey.Remove(sbKey.Length - 1, 1);rn strSql += sbKey.ToString() + ") Values (";rn rnrn // 生成值rn StringBuilder sbValue = new StringBuilder();rn string str = "";rn for (int i = 0; i < dReader.FieldCount; i++)rn rn str = GetStringByDataTypeForSql(dt.Rows[i][5].ToString(), dReader[i].ToString());rn sbValue.Append(str + ",");rn //取主键对应的值rn if (i == keylocation)rn value = dReader[i] == null ? "" : dReader[i].ToString();rn rn sbValue.Remove(sbValue.Length - 1, 1);rnrn //检测将要插入的记录在数据库是否已经存在,不存在才插入rn if (m_targetDbType == DataBaseType.SqlServe)rn rn var checksql = "";rn if (key != "")rn rn checksql = @"select count(1) from 0 where 1='2'";rn checksql = String.Format(checksql, TableName, key, value);rn rn var count = SqlDB.ExecuteNonQuery(this.m_targetStr, checksql);rn if (count == 0)rn rn sb.Append(strSql);rn sb.Append(sbValue).Append(");");rn rn rnrn if (flag == batchRow)rn rn if (m_targetDbType == DataBaseType.Oracle)rn rn ret += OracleDB.ExecuteNonQuery(this.m_targetStr, sb.ToString());rn rn elsern rn ret += SqlDB.ExecuteNonQuery(this.m_targetStr, sb.ToString());rn rn sb = new StringBuilder();rn flag = 0;rn rn rn if (flag != 0)rn rn if (m_targetDbType == DataBaseType.Oracle)rn rn ret += OracleDB.ExecuteNonQuery(this.m_targetStr, sb.ToString());rn rn elsern rn ret += SqlDB.ExecuteNonQuery(this.m_targetStr, sb.ToString());rn rn rn return ret;rn rn[/code] 论坛

不能为空。参数名: s

07-17

代码如下:rnrnrnrn Dim myConnection As SqlConnection = New SqlConnection( _rn "server=(172.18.3.180)\NetSDK;database=youth;Integrated Security=SSPI")rn Dim myCommand As SqlCommand = New SqlCommand("select * from adminusers", myConnection)rnrn myConnection.Open()rnrnrn Dim dr As SqlDataReader = myCommand.ExecuteReader()rn rnrn myConnection.Close()rnrnrn错误如下! 怎么办?rn---------------rnrn值不能为空。参数名: s rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.ArgumentNullException: 值不能为空。参数名: srnrn源错误: rnrn执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 rnrn堆栈跟踪: rnrnrn[ArgumentNullException: 值不能为空。rn参数名: s]rn System.IO.StringReader..ctor(String s) +78rn System.Web.FormatterWithFileInfo.GetSourceFileLines(String fileName, Encoding encoding, String sourceCode, Int32 lineNumber) +221rn System.Web.UnhandledErrorFormatter.get_ColoredSquareContent() +269rn System.Web.ErrorFormatter.GetHtmlErrorMessage(Boolean dontShowSensitiveInfo) +831rn System.Web.HttpResponse.WriteErrorMessage(Exception e, Boolean dontShowSensitiveErrors) +1385rn System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow) +444rn System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e) +486rnrn rnrnrn--------------------------------------------------------------------------------rn版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573 论坛

不能为空。参数名: String

11-19

using System;rnusing System.Collections;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Web;rnusing System.Web.SessionState;rnusing System.Web.UI;rnusing System.Web.UI.WebControls;rnusing System.Web.UI.HtmlControls;rnusing System.Data.OleDb;rnrnnamespace dqdprnrn /// rn /// WebForm1 的摘要说明。rn /// rn public class WebForm1 : System.Web.UI.Pagern rn private void Page_Load(object sender, System.EventArgs e)rn rn // 在此处放置用户代码以初始化页面rn int imgid=int.Parse(Request.QueryString["imgid"]);rn string connString="server=192.168.1.2;database=IMAGE;uid=gjjywxt;pwd=gjjywxt";rn OleDbConnection conn = new OleDbConnection(connString); rn string selString ="SELECT * FROM IMAGE Where ImageID=:ImageID";rn OleDbCommand comm = new OleDbCommand(selString,conn);rn comm.Parameters.Add(new OleDbParameter(":IMAGEID",OleDbType.Numeric,4));rn comm.Parameters[":IMAGEID"].Value = imgid; rn conn.Open();rn OleDbDataReader dr = comm.ExecuteReader();rn dr.Read();rn Response.ContentType=(string)dr["ImageContentType"];rn Response.OutputStream.Write((byte[])dr["ImageData"],0,(int)dr["ImageSize"]);rn Response.End();rn conn.Close();rn rn rnrn #region Web 窗体设计器生成的代码rn override protected void OnInit(EventArgs e)rn rn //rn // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。rn //rn InitializeComponent();rn base.OnInit(e);rn rn rn /// rn /// 设计器支持所需的方法 - 不要使用代码编辑器修改rn /// 此方法的内容。rn /// rn private void InitializeComponent()rn rn this.Load += new System.EventHandler(this.Page_Load);rnrn rn #endregionrn rnrn请高手指点指点改怎么解决! 论坛

数名报错问题~

08-12

private void Button1_Click(object sender, System.EventArgs e)rn rn string filetitle=this.TBfname.Text;rn Stream filedatastream=myfile.PostedFile.InputStream;rn int filelength=myfile.PostedFile.ContentLength;rn string filetypestr=myfile.PostedFile.ContentType;rn byte[] filedata=new byte[filelength];rn filedatastream.Read(filedata,0,filelength);rnrn SqlConnection conn=new SqlConnection("server=(local);database=MyWeb;uid=sa;pwd=sa");rn conn.Open();rn string sqlstr=""+"insert into Myfile (name,content,filetype) values(@name,@content,@filetype)"+"";rn SqlCommand com=new SqlCommand(sqlstr,conn);rnrn SqlParameter pname=new SqlParameter(@name,SqlDbType.VarChar,40);rn fname.Value=filetitle;rn com.Parameters.Add(pname);rnrn SqlParameter pcontent=new SqlParameter(@content,SqlDbType.Image);rn fcontent.Value=filedata;rn com.Parameters.Add(pcontent);rnrn SqlParameter ptype=new SqlParameter(@filetype,SqlDbType.VarChar,20);rn ftype.Value=filetypestr;rn com.Parameters.Add(ptype);rnrn com.ExecuteNonQuery();rn conn.Close();rn rnrn上面是WEB中一个上传文件的代码:rn运行报错:rn名称“content”在类或命名空间“MyWeb.updown”中不存在rn名称“filetype”在类或命名空间“MyWeb.updown”中不存在 rn名称“name”在类或命名空间“MyWeb.updown”中不存在rnrn报错的地方分别在 添加3个参数的地方 rn@name,SqlDbTy.... rn@content,SqlDbTy....rn@filetype,SqlDbTy....rn这里是定义参数名,应该不会报这样的错啊?哪位前辈知道的指点下~谢谢 论坛

ArgumentoutofRangException 参数名 index

09-15

下面的代码报这样的错误:rnArgumentoutofRangException 参数名 index,请高手指点,rn if (header.Rows.Count > 0)rn这一段代码是出错后加的,但我不知道是不是这个原因?rn rnrn Tableware ti = new Tableware();rn tableware_Delivery td = new tableware_Delivery();rnrn string sql = "select * from sendreceiptheader where updatestatus= 0";rn string newautoid = "";rn DataTable header = sqlce.ExeSqlForDT(sql);rn if (header.Rows.Count > 0)rn rn for (int i = 0; i < header.Rows.Count; i++)rn rnrn DataRow dr = header.Rows[i];rn string cphid = DBhandle.getcphid(dr["cph"].ToString());rn ArrayList arys = new ArrayList();rn string sql1 = "select * from sendreceiptdetail where updatestatus= 0 and autoid ='" + dr["autoid"].ToString() + "'";rn DataTable detail = sqlce.ExeSqlForDT(sql1);rn Int16 khxs = 0;rn Int16 khgs = 0;rn DataTable dt = Tableware.getKHStock(dr["khph"].ToString());rn if (dt.Rows.Count > 0)rn rn khxs = Convert.ToInt16(dt.Rows[0]["kcxs"].ToString());rn khgs = Convert.ToInt16(dt.Rows[0]["kcgs"].ToString());rn rn string Autoid_ck = td.getAutoid_ck(cphid);rn newautoid = td.getAutoid_ssh(dr["khph"].ToString(), Autoid_ck);rn if (newautoid == string.Empty)rn rn newautoid = DBhandle.Autoid("D", "sshid");rnrn //开始保存rn arys.Clear();rn arys.Add(newautoid);rn arys.Add(Autoid_ck);rn arys.Add(dr["khph"].ToString());rn arys.Add(dr["khmc"].ToString());rn arys.Add(cphid);rn arys.Add(DBhandle.getygbh(dr["sfy"].ToString()));rn arys.Add(dr["sfydh"].ToString());//sfyp 送货员电话rn arys.Add(dr["tsdh"].ToString());//tsp 投诉电话rn arys.Add(dr["hsxs"].ToString());rn arys.Add(dr["hsgs"].ToString());rn arys.Add("");// 退换产品型号rn arys.Add("");// 退换箱数rn arys.Add(dr["return_qty"].ToString());//退换套数rn arys.Add(khxs);//记录当时客户的箱数rn arys.Add(khgs);//记录当时客户的盖数rn arys.Add(userid);rn arys.Add("N");rn arys.Add("N");rn arys.Add(dr["autoid"].ToString());rn tableware_Delivery.savessh("add", arys);rn rn elsern rn arys.Clear();rn arys.Add(newautoid);rn arys.Add(dr["hsxs"].ToString());rn arys.Add(dr["hsgs"].ToString());rn arys.Add(dr["return_qty"].ToString());//退换套数rn arys.Add(khxs);//记录当时客户的箱数rn arys.Add(khgs);//记录当时客户的盖数rn tableware_Delivery.savessh("upd", arys);rn rnrn if (Convert.ToInt32(dr["hsxs"].ToString()) > 0 || Convert.ToInt32(dr["hsgs"].ToString()) > 0)rn rn //更新客户库存rn arys.Clear();rn arys.Add(dr["khph"].ToString());rn arys.Add(dr["khmc"].ToString());rn arys.Add("");rn arys.Add("-" + dr["hsxs"].ToString());rn arys.Add("-" + dr["hsgs"].ToString());//盖数rn arys.Add(DateTime.Now);rn arys.Add(userid);rn tableware_Delivery.updateStock_hk("add", arys);rn rnrnrn for (int j = 0; j < detail.Rows.Count; j++)rn rn Int32 xs = 0;rn DataRow dr_detail = detail.Rows[j];rn Int32 gs = Convert.ToInt32(DBhandle.getKHgs(dr_detail["cpxh"].ToString(), dr_detail["xs"].ToString()));rn if (gs == 0)rn rn xs = Convert.ToInt32(dr_detail["xs"].ToString());rn rn Int32 qty = Convert.ToInt32(dr_detail["qty"].ToString());rnrn //更新客户库存rn arys.Clear();rn arys.Add(dr["khph"].ToString());rn arys.Add(dr["khmc"].ToString());rn string cpxhid = DBhandle.getcpxhid(dr_detail["cpxh"].ToString());rn arys.Add(cpxhid);rn arys.Add(xs);rn arys.Add(gs);//盖数rn arys.Add(DateTime.Now);rn arys.Add(userid);rn string ppid = DBhandle.getppid(dr_detail["pp"].ToString());rn arys.Add(ppid);rn tableware_Delivery.updateStock_hk("add", arys);rnrn arys.Clear();rn arys.Add(newautoid);rn arys.Add("ssh");rn arys.Add(cpxhid);rn if (gs > 0)rn rn arys.Add(gs);rn rn elsern rn arys.Add(xs);rn rn arys.Add(qty);rn arys.Add(ppid);rn decimal price = Convert.ToDecimal(ti.getkhxydj(dr["khph"].ToString(), dr_detail["cpxh"].ToString()));rn arys.Add(price.ToString());rn arys.Add((qty * price).ToString());rn tableware_Delivery.savecj("", arys);rn rn updatelocalsendreceiptheaderstatus(dr["autoid"].ToString());rn updatelocalsendreceiptdetailstatus(dr["autoid"].ToString());rn rn 论坛

“/”应用程序中的服务器错误。值不能为空。参数名: value

08-30

“/”应用程序中的服务器错误。rn--------------------------------------------------------------------------------rnrn值不能为空。rn参数名: value rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.ArgumentNullException: 值不能为空。rn参数名: valuernrn源错误: rnrn执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 rnrn堆栈跟踪: rnrnrn[ArgumentNullException: 值不能为空。rn参数名: value]rn System.Web.Caching.CacheEntry..ctor(String key, Object value, CacheDependency dependency, CacheItemRemovedCallback onRemovedHandler, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, Boolean isPublic) +8842779rn System.Web.Caching.CacheInternal.DoInsert(Boolean isPublic, String key, Object value, CacheDependency dependencies, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback, Boolean replace) +93rn System.Web.Caching.Cache.Insert(String key, Object value, CacheDependency dependencies, DateTime absoluteExpiration, TimeSpan slidingExpiration) +79rn Dvbbs.Utils.Caching.Set(String name, Object value, CacheDependency cacheDependency, DateTime dt, TimeSpan ts) +85rn Dvbbs.Utils.Caching.Set(String name, Object value, CacheDependency cacheDependency) +153rn Dvbbs.bbs.Handlers.UserHandler.GetUserRoles(Connection conn) +117rn Dvbbs.bbs.Handlers.UserHandler.GetRole(Int32 roleid, Int32 experience, Connection conn) +19rn Dvbbs.bbs.Entity.User.GetStrategy(StrategyEnum type, Connection conn) +147rn Dvbbs.bbs.Handlers.UserHandler.CheckAllowPower(User user, PopStrategyEnum power, Connection conn) +48rn Dvbbs.bbs.Kernel.Main.CheckAllowAccess() +39rn Dvbbs.bbs.Kernel.Main.OnInit(EventArgs e) +139rn Dvbbs.bbs.UI.Forum.index.OnInit(EventArgs e) +41rn System.Web.UI.Control.InitRecursive(Control namingContainer) +333rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378rnrn rnrnrn--------------------------------------------------------------------------------rn版本信息: Microsoft .NET Framework 版本:2.0.50727.3053; ASP.NET 版本:2.0.50727.3618 rnrnrnrnrnrn新手求助。我不懂.net。先网站更换空间。rn之后就报这个错误。rn百度google搜了不少。还是不能解决。rn求教。rn只有ftp 管理权限。其他都要提交工单。rn怎么办? 论坛

[ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。 参数名: value]

01-25

单位网站用的是动易后台,我今年过去领导让我接手网站,说真的之前没接触过,也不知道发这个板块是不是 合适。今天在后台审核稿件的时候出现这个错误,那会前台还可以打开,晚上网站都打不开了。请各位看看了。SQL2005,.net1.1和2.0都装了,server2003系统。rnrn“/”应用程序中的服务器错误rn指定的参数已超出有效值的范围。rn参数名: value rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。rn参数名: valuernrn源错误: rnrn执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 rnrn堆栈跟踪: rnrnrn[ArgumentOutOfRangeException: 指定的参数已超出有效值的范围。rn参数名: value]rnSystem.Web.UI.WebControls.GridView.set_PageIndex(Int32 value) +1353283rnPowerEasy.Framework.Controls.ExtendedGridView.set_PageIndex(Int32 value) +32rnPowerEasy.Framework.Controls.ExtendedGridView.LoadHoldState() +468rnPowerEasy.Framework.Controls.ExtendedGridView.OnLoad(EventArgs e) +30rnSystem.Web.UI.Control.LoadRecursive() +50rnSystem.Web.UI.Control.LoadRecursive() +141rnSystem.Web.UI.Control.LoadRecursive() +141rnSystem.Web.UI.Control.LoadRecursive() +141rnSystem.Web.UI.Control.LoadRecursive() +141rnSystem.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627rn 论坛

没有更多推荐了,返回首页