Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / What does VS.NET use to initialize the SQLCommand parameters if no values supplied? / 1 сообщений из 1, страница 1 из 1
06.11.2003, 22:52
    #32317654
Gobzo Kobler
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
What does VS.NET use to initialize the SQLCommand parameters if no values supplied?
Hi all:
There is no Cyrillic on this machine again, so please bear with my English. I am wrinting a cimple C# application and one of the things should allow me to supply the date range to a query. Initially the parameters should be blank and I thought of the following construct:
Код: plaintext
1.
WHERE date_column BETWEEN ISNULL(NULLIF (@begin_date, '1900-01-01 00:00:00'), CONVERT(DATETIME, '1900-01-01 00:00:00',  102 )) AND ISNULL(NULLIF (@end_date, '1900-01-01 00:00:00'), CONVERT(DATETIME, '2099-01-01 00:00:00',  102 )))


This works fine in SQL 2000 and gives me back entire table, but the result set in VS.NET query builder is empty. I tried to trace, but this bastard uses xp_execsql to run the queries, so I do not see the parameter values that it passes.

I compiled a small proc:
Код: plaintext
CREATE PROC a @a DATETIME AS SELECT @a


When called from VS.NET with empty parameters it displays 12:00 AM. How do I use this information now? What SQL string do I need to use in order to allow the user to pass certain date range or to skip and provide empty values?

TIA,
Gobzo
...
Рейтинг: 0 / 0
Форумы / WinForms, .Net Framework [игнор отключен] [закрыт для гостей] / What does VS.NET use to initialize the SQLCommand parameters if no values supplied? / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]