Gostaria de saber como recuperar uma data como dado dos Milissegundos gravados em um Banco de Dados MS SQL Server 2019 usando o VB.Net + ADO.Net.
Sempre que tento resgatar a data, vem no fomrmato "dd/MM/yyyy HH:mm:ss" eu gostaria de também ter os ".fff", mas não consigo recuperar esta informação no BD.
*** código do MODEL:
Private _DataAlteracao As DateTime
Public Property DataAlteracao() As DateTime
Get
Return _DataAlteracao
End Get
Set(ByVal value As DateTime)
_DataAlteracao = value
End Set
End Property
*** Código do INSERT:
Public Overloads Function InserirHistorico(entidade As ClsHistoricoDomain) As Object
Dim objConfirma As Object
MyBase.LimparStrComando()
MyBase.StrComando.AppendLine(" INSERT INTO tblHistorico (")
MyBase.StrComando.AppendLine(" CNPJ, ")
MyBase.StrComando.AppendLine(" RazaoSocial, ")
MyBase.StrComando.AppendLine(" NomeFantasia, ")
MyBase.StrComando.AppendLine(" CodigoSistema, ")
MyBase.StrComando.AppendLine(" DataAlteracao) ")
MyBase.StrComando.AppendLine(" VALUES (")
MyBase.StrComando.Append(IIf(Not String.IsNullOrEmpty(entidade.CNPJ), String.Format("'{0}',{1}", entidade.CNPJ, Environment.NewLine), "NULL,"))
MyBase.StrComando.Append(IIf(Not String.IsNullOrEmpty(entidade.RazaoSocial), String.Format("'{0}',{1}", entidade.RazaoSocial, Environment.NewLine), "NULL,"))
MyBase.StrComando.Append(IIf(Not String.IsNullOrEmpty(entidade.NomeFantasia), String.Format("'{0}',{1}", entidade.NomeFantasia, Environment.NewLine), "NULL,"))
MyBase.StrComando.Append(IIf(Not String.IsNullOrEmpty(entidade.CodigoSistema), String.Format("'{0}',{1}", entidade.CodigoSistema, Environment.NewLine), "NULL,"))
MyBase.StrComando.Append(IIf(Not String.IsNullOrEmpty(entidade.DataAlteracao), String.Format("'{0}',{1}", entidade.DataAlteracao, Environment.NewLine), "NULL,"))
MyBase.StrComando.AppendLine(")")
objConfirma = SQLHelper.ExecuteScalar(StrComando.Remove(StrComando.ToString.LastIndexOf(","), 1).ToString(), True)
Return objConfirma
End Function
*** Código do SELECT TODOS:
Public Overrides Function SelecionarTodos() As List(Of ClsHistoricoDomain)
MyBase.LimparStrComando()
MyBase.StrComando.AppendLine(" SELECT CNPJ, ")
MyBase.StrComando.AppendLine(" RazaoSocial, ")
MyBase.StrComando.AppendLine(" NomeFantasia, ")
MyBase.StrComando.AppendLine(" CodigoSistema, ")
MyBase.StrComando.AppendLine(" DataAlteracao ")
MyBase.StrComando.AppendLine(" FROM tblHistorico ")
Return MyBase.RetornaLista(StrComando.ToString())
End Function