首页蓝耳朵|小小蓝耳朵广州图书馆外文室英语儿童读物资源介绍网佛教青年之友旧版收集永硕E盘Phonics Short Vowels Game 
找不到方法:“Void System.Web.UI.WebControls.Parameter..ctor(System.String, System.Data.DbType, System.String)”
所属栏目:ASP.NET(webform)  时间:2009-07-25 18:09  作者:狼子

解决办法:把使用DbType的地方换成用TypeCode,比如:

SdsTest.SelectParameters.Add(new Parameter("CategoryID", DbType.Int32, cid));

要换成:

SdsTest.SelectParameters.Add("CategoryID", TypeCode.Int32, Request.QueryString["c"]);

以下截自:http://www.pchenry.com/Home/tabid/36/EntryID/40/Default.aspx

Re: SQL Server access resultings in a Page Not Found error in IIS but works perfectly on Vista?

Thanks a lot! I was able to solve my problem by swapping DbType.xxx to TypeCode.xxx. I didn't find your post directly, cause I was googling for "'Void System.Web.UI.WebControls.Parameter..ctor(System.String, System.Data.DbType, System.String)".

I don't understand how this problem can occur though. How can it be that this code runs just fine on my dev machine? My project is created in VS2008, but the project is targetted at .Net Framework 2.0. So how is it possible that the code runs just fine on my dev machine (both in ASP.NET Development Server as on the locally installed IIS 5.1)? Does it mean the code isn't using the 2.0 version but is using 3.5 instead? Or does the 2.0 version of the webcontrols dll get overwritten by a new version when installing VS2008? Or more precise, is the 2.0 version of .Net that gets installed as part of .Net 3.5 another version than the original 2.0 version?

Also, the help file of Visual Studio 2008 does not include the DbType.xxx version of the Parameter constructor, but IntelliSense does!

So this means I have to test my .Net 2.0 apps on a machine with .Net 3.5 installend and also on a machine with .Net 2.0 installed? Thank you very much Microsoft...

Thank you Dick for leaving the comment, sorry I wasn't help to help out sooner. I added your search string to the blog entry, hopefully it'll come up on someone else's google search next time.

re how can this occur
Cause MS pulled out some functionality in one ver of the CLR and replaced it back in in a subsequent ver. I don't have the specific numbers in front of me, but I think it was the 2.0 they pulled it out of, which is why it works on your dev box (probably using 3.5 right?) but your IIS 5.1 is probably using 2.0 which I think (if memory serves me correctly but I'm going on one coffee haha) doesn't have that support.

You shouldn't need to retest on different vers of the CLR, at least you shouldn't need to. This is ONE and my first hiccup like this I've encountered, so although it's wise to be aware of this, it's not something to start requesting budgets and staffing up new departments to test for. haha

Hope you have a good one!

小楼宝宝的涂鸦花花(Imitater)的博客起名称骨测字皖ICP备06000023号-17