Hi!
I have the following sp:
ALTER PROCEDURE dbo.[Buscar Clientes]
(
@.Begin As DateTime = Null,
@.End As DateTime = Null
)
In VS 2003, If i dont enter any value in the parameters, shouldnt both be
Null?
If i dont enter any value for the parameters i get the following error when
i use the Fill method: "String was not recognized as a valid datetime"
When i look into the Parameters in my DataAdpter, the value field is empty.
Can anyboy help me out?
Thanks,
BRuno N> In VS 2003, If i dont enter any value in the parameters, shouldnt both be
> Null?
YEs, they are NULL as far as T-SQL is concerned.
> If i dont enter any value for the parameters i get the following error
when
> i use the Fill method: "String was not recognized as a valid datetime"
I assume this stored procedure then returns a resultset, and this is what
you are using for Fill. Your C# or VB.Net code needs to deal with DBNull...
or, you need to change your SELECT statement so that IT deals with the NULL
values appropriately.
In other words, your error is not because your date is NULL within SQL
Server, your error is because your .NET code does not deal with it
correctly.|||Thank you!
I will look into my code
"Bruno N" <nylren@.hotmail.com> escreveu na mensagem
news:%23Z5g3pkLFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Hi!
> I have the following sp:
> ALTER PROCEDURE dbo.[Buscar Clientes]
> (
> @.Begin As DateTime = Null,
> @.End As DateTime = Null
> )
> In VS 2003, If i dont enter any value in the parameters, shouldnt both be
> Null?
> If i dont enter any value for the parameters i get the following error
> when i use the Fill method: "String was not recognized as a valid
> datetime"
> When i look into the Parameters in my DataAdpter, the value field is
> empty.
>
> Can anyboy help me out?
> Thanks,
> BRuno N
>|||Bruno,
You can assign DBNull.Value to the parameter value. You can also not append
the parameters to the collection at all, ADO.NET use named parameters when
using sqlClient data provider.
AMB
"Bruno N" wrote:
> Thank you!
> I will look into my code
> "Bruno N" <nylren@.hotmail.com> escreveu na mensagem
> news:%23Z5g3pkLFHA.2604@.TK2MSFTNGP10.phx.gbl...
>
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment