admin管理员组文章数量:1410674
I´m having problems with the next error
Stack Trace:
Exception type: InvalidCastException Exception message: The specified conversion is not valid. on System.Data.SqlClient.SqlBuffer.get_DateTime() on System.Data.SqlClient.SqlDataReader.GetDateTime(Int32 i) on Read_Table_Zona(ObjectMaterializer`1 ) on System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReader`2.MoveNext() on System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) on System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) on ...ReporteDA.GetZona()
I generated my database scheme from Server Explorer update it from the production env, but while it's on production sometimes this error appears and throws the site
Code:
public static List<Table_Zona> GetZona()
{
dc = new DBDataContext();
var list = dc.Table_Zona.ToList();
return list;
}
DBDataContext:
public DBDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["BD_RConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}
Table_Zona:
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Table_Zona")]
public partial class Table_Zona : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _id;
private string _Zona;
private string _Descripcion;
private System.Nullable<System.DateTime> _fListaContador;
private System.Nullable<System.DateTime> _fListaAsesor;
private string _TableName;
private EntitySet<Table_Agencia> _Table_Agencias;
// ...
}
Database:
CREATE TABLE [dbo].[Table_Zona](
[id] [int] IDENTITY(1,1) NOT NULL,
[Zona] [varchar](20) NOT NULL,
[Descripcion] [varchar](50) NULL,
[fListaContador] [datetime] NULL,
[fListaAsesor] [datetime] NULL,
[TableName] [nvarchar](150) NULL
)
id | Zona | Descripcion | fListaContador | fListaAsesor | TableName |
---|---|---|---|---|---|
1 | Zona A | Zona A | NULL | NULL | Table_ReportesZA |
2 | Zona B | Zona B | NULL | NULL | Table_Reportes |
本文标签: cInvalidCastException getDateTime() on SystemDataLinqStack Overflow
版权声明:本文标题:c# - InvalidCastException get_DateTime() on System.Data.Linq - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745068760a2640683.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论