问题
I am using a Session Parameter on an ObjectDataSource. It works fine on the local development machine but I get this error after copying the website to the production server:
Type 'System.Web.UI.WebControls.SessionParameter' does not have a public property named 'DbType'.
回答1:
Me again!
First Answer I gave was WRONG!
Correct answer is that .NET Framework v3.5 was installed, and it needs to be updated to .NET framework 3.5 SP1
回答2:
I found the answer but I don't know why it does this.
I just removed the DBType property and it worked fine.
回答3:
I change DbType to Type and this got the site working.
回答4:
The solution is replace DBType by Type. And find the Ansi especification.
By example I have this code:
DBType ="AnsiString"
an change it by
Type="String"
and working fine.
回答5:
Travis' answer gave me a clue, but perhaps it could be stated better thusly:
Somehow, in copying the website to the production server, a number of the parameter objects (Specifically, those with type GUID) had the "Type"="Guid" element changed to "DBType"="Guid".
e.g parameter should be:
NOT
回答6:
Confirmed: This requires .NET Framework 3.5 SP1 update.
回答7:
Wow I also removed DbType="Date" and it started working. did'nt even bother publishing, just changed it on the server with notepad. Thanks
回答8:
well. you should change it. eg. if it is DbType="Guid" then change it to Type="Object"
来源:https://stackoverflow.com/questions/184254/type-system-web-ui-webcontrols-sessionparameter-does-not-have-a-public-propert