powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / ADO.NET, LINQ, Entity Framework, NHibernate, DAL, ORM [игнор отключен] [закрыт для гостей] / data types .NET vs OleDb
9 сообщений из 9, страница 1 из 1
data types .NET vs OleDb
    #32975488
Фотография Ex_Soft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
SyBase ASE 12.5

создал для теста типов ХП
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
create procedure sp_TestTypes 
  @FDecimal_4_0 decimal( 4 , 0 ),
  @FDecimal_4_2 decimal( 4 , 2 ),
  @FDecimal_5_0 decimal( 5 , 0 ),
  @FDecimal_5_2 decimal( 5 , 2 ),
  @FDecimal_8_0 decimal( 8 , 0 ),
  @FDecimal_8_2 decimal( 8 , 2 ),
  @FDecimal_9_0 decimal( 9 , 0 ),
  @FDecimal_9_2 decimal( 9 , 2 ),
  @FDecimal_10_0 decimal( 10 , 0 ),
  @FDecimal_10_2 decimal( 10 , 2 ),
  @FDecimal_18_0 decimal( 18 , 0 ),
  @FDecimal_18_2 decimal( 18 , 2 ),
  @FNumeric_4_0 numeric( 4 , 0 ),
  @FNumeric_4_2 numeric( 4 , 2 ),
  @FNumeric_5_0 numeric( 5 , 0 ),
  @FNumeric_5_2 numeric( 5 , 2 ),
  @FNumeric_8_0 numeric( 8 , 0 ),
  @FNumeric_8_2 numeric( 8 , 2 ),
  @FNumeric_9_0 numeric( 9 , 0 ),
  @FNumeric_9_2 numeric( 9 , 2 ),
  @FNumeric_10_0 numeric( 10 , 0 ),
  @FNumeric_10_2 numeric( 10 , 2 ),
  @FNumeric_18_0 numeric( 18 , 0 ),
  @FNumeric_18_2 numeric( 18 , 2 ),
  @FMoney money,
  @FDecimal_4_0_out decimal( 4 , 0 ) output,
  @FDecimal_4_2_out decimal( 4 , 2 ) output,
  @FDecimal_5_0_out decimal( 5 , 0 ) output,
  @FDecimal_5_2_out decimal( 5 , 2 ) output,
  @FDecimal_8_0_out decimal( 8 , 0 ) output,
  @FDecimal_8_2_out decimal( 8 , 2 ) output,
  @FDecimal_9_0_out decimal( 9 , 0 ) output,
  @FDecimal_9_2_out decimal( 9 , 2 ) output,
  @FDecimal_10_0_out decimal( 10 , 0 ) output,
  @FDecimal_10_2_out decimal( 10 , 2 ) output,
  @FDecimal_18_0_out decimal( 18 , 0 ) output,
  @FDecimal_18_2_out decimal( 18 , 2 ) output,
  @FNumeric_4_0_out numeric( 4 , 0 ) output,
  @FNumeric_4_2_out numeric( 4 , 2 ) output,
  @FNumeric_5_0_out numeric( 5 , 0 ) output,
  @FNumeric_5_2_out numeric( 5 , 2 ) output,
  @FNumeric_8_0_out numeric( 8 , 0 ) output,
  @FNumeric_8_2_out numeric( 8 , 2 ) output,
  @FNumeric_9_0_out numeric( 9 , 0 ) output,
  @FNumeric_9_2_out numeric( 9 , 2 ) output,
  @FNumeric_10_0_out numeric( 10 , 0 ) output,
  @FNumeric_10_2_out numeric( 10 , 2 ) output,
  @FNumeric_18_0_out numeric( 18 , 0 ) output,
  @FNumeric_18_2_out numeric( 18 , 2 ) output,
  @FMoney_out money output
as 
begin
  declare
    @RetVal int

  select @FDecimal_4_0_out = @FDecimal_4_0
  select @FDecimal_4_2_out = @FDecimal_4_2
  select @FDecimal_5_0_out = @FDecimal_5_0
  select @FDecimal_5_2_out = @FDecimal_5_2
  select @FDecimal_8_0_out = @FDecimal_8_0
  select @FDecimal_8_2_out = @FDecimal_8_2
  select @FDecimal_9_0_out = @FDecimal_9_0
  select @FDecimal_9_2_out = @FDecimal_9_2
  select @FDecimal_10_0_out = @FDecimal_10_0
  select @FDecimal_10_2_out = @FDecimal_10_2
  select @FDecimal_18_0_out = @FDecimal_18_0
  select @FDecimal_18_2_out = @FDecimal_18_2
  select @FNumeric_4_0_out = @FNumeric_4_0
  select @FNumeric_4_2_out = @FNumeric_4_2
  select @FNumeric_5_0_out = @FNumeric_5_0
  select @FNumeric_5_2_out = @FNumeric_5_2
  select @FNumeric_8_0_out = @FNumeric_8_0
  select @FNumeric_8_2_out = @FNumeric_8_2
  select @FNumeric_9_0_out = @FNumeric_9_0
  select @FNumeric_9_2_out = @FNumeric_9_2
  select @FNumeric_10_0_out = @FNumeric_10_0
  select @FNumeric_10_2_out = @FNumeric_10_2
  select @FNumeric_18_0_out = @FNumeric_18_0
  select @FNumeric_18_2_out = @FNumeric_18_2
  select @FMoney_out = @FMoney

  select @RetVal= 65535  
 
  return(@RetVal)
end

OleDbCommandBuilder.DeriveParameters()
RETURN_VALUE
Direction: ReturnValue
OleDbType: Integer
DbType: Int32

FDecimal_4_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_4_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_5_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_5_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_8_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_8_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_9_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_9_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_10_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_10_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_18_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FDecimal_18_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_4_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_4_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_5_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_5_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_8_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_8_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_9_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_9_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_10_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_10_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_18_0
Direction: Input
OleDbType: Numeric
DbType: Decimal

FNumeric_18_2
Direction: Input
OleDbType: Numeric
DbType: Decimal

FMoney
Direction: Input
OleDbType: Currency
DbType: Currency

FDecimal_4_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_4_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_5_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_5_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_8_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_8_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_9_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_9_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_10_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_10_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_18_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FDecimal_18_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_4_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_4_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_5_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_5_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_8_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_8_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_9_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_9_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_10_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_10_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_18_0_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FNumeric_18_2_out
Direction: Output
OleDbType: Numeric
DbType: Decimal

FMoney_out
Direction: Output
OleDbType: Currency
DbType: Currency

вызываю
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
cmd.CommandText="{? = call sp_TestTypes(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
cmd.Parameters.Clear();

SPRetValue=cmd.Parameters.Add("@return",SqlDbType.Int);
SPRetValue.Direction=ParameterDirection.ReturnValue;

cmd.Parameters.Add("@FDecimal_4_0",OleDbType.Numeric).Value= 9999 ;
cmd.Parameters.Add("@FDecimal_4_2",OleDbType.Numeric).Value= 9999 . 99 ;
cmd.Parameters.Add("@FDecimal_5_0",OleDbType.Numeric).Value= 99999 ;
cmd.Parameters.Add("@FDecimal_5_2",OleDbType.Numeric).Value= 99999 . 99 ;
cmd.Parameters.Add("@FDecimal_8_0",OleDbType.Numeric).Value= 99999999 ;
cmd.Parameters.Add("@FDecimal_8_2",OleDbType.Numeric).Value= 99999999 . 99 ;
cmd.Parameters.Add("@FDecimal_9_0",OleDbType.Numeric).Value= 999999999 ;
cmd.Parameters.Add("@FDecimal_9_2",OleDbType.Numeric).Value= 999999999 . 99 ;
cmd.Parameters.Add("@FDecimal_10_0",OleDbType.Numeric).Value= 9999999999 ;
cmd.Parameters.Add("@FDecimal_10_2",OleDbType.Numeric).Value= 9999999999 . 99 ;
cmd.Parameters.Add("@FDecimal_18_0",OleDbType.Numeric).Value= 999999999999999999 ;
cmd.Parameters.Add("@FDecimal_18_2",OleDbType.Numeric).Value= 999999999999999999 . 99 ;
cmd.Parameters.Add("@FNumeric_4_0",OleDbType.Numeric).Value= 9999 ;
cmd.Parameters.Add("@FNumeric_4_2",OleDbType.Numeric).Value= 9999 . 99 ;
cmd.Parameters.Add("@FNumeric_5_0",OleDbType.Numeric).Value= 99999 ;
cmd.Parameters.Add("@FNumeric_5_2",OleDbType.Numeric).Value= 99999 . 99 ;
cmd.Parameters.Add("@FNumeric_8_0",OleDbType.Numeric).Value= 99999999 ;
cmd.Parameters.Add("@FNumeric_8_2",OleDbType.Numeric).Value= 99999999 . 99 ;
cmd.Parameters.Add("@FNumeric_9_0",OleDbType.Numeric).Value= 999999999 ;
cmd.Parameters.Add("@FNumeric_9_2",OleDbType.Numeric).Value= 999999999 . 99 ;
cmd.Parameters.Add("@FNumeric_10_0",OleDbType.Numeric).Value= 9999999999 ;
cmd.Parameters.Add("@FNumeric_10_2",OleDbType.Numeric).Value= 9999999999 . 99 ;
cmd.Parameters.Add("@FNumeric_18_0",OleDbType.Numeric).Value= 999999999999999999 ;
cmd.Parameters.Add("@FNumeric_18_2",OleDbType.Numeric).Value= 999999999999999999 . 99 ;
cmd.Parameters.Add("@FMoney",OleDbType.Currency).Value= 922337203685477 . 5807 ;
SPResult=cmd.Parameters.Add("@FDecimal_4_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_4_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_5_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_5_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_8_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_8_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_9_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_9_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_10_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_10_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_18_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FDecimal_18_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_4_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_4_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_5_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_5_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_8_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_8_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_9_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_9_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_10_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_10_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_18_0_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FNumeric_18_2_out",OleDbType.Numeric);
SPResult.Direction=ParameterDirection.Output;
SPResult=cmd.Parameters.Add("@FMoney_out",OleDbType.Currency);
SPResult.Direction=ParameterDirection.Output;

cmd.ExecuteNonQuery();
имею... ;)
OverflowException.Message
Value was either too large or too small for a Currency.

хотя
refman1.pdf
money Денежные величины в диапазоне от +922 337 203 685 477,5807 до -922 337 203 685 477,5808

фиг с тобой, золотая рыбка, - меняю
Код: plaintext
1.
cmd.Parameters.Add("@FMoney",OleDbType.Currency).Value= 999 . 9999 ;
имею... ;)
OleDbException.Message
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '9999.99' to a DECIMAL field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '99999.99' to a DECIMAL field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '99999999.99' to a DECIMAL field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '999999999.99' to a DECIMAL field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '9999999999.99' to a DECIMAL field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '1000000000000000000' to a DECIMAL field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '9999.99' to a NUMERIC field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '99999.99' to a NUMERIC field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '99999999.99' to a NUMERIC field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '999999999.99' to a NUMERIC field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '9999999999.99' to a NUMERIC field .
[Native Error code: 247]
[DataDirect ADO Sybase Provider] Arithmetic overflow during implicit conversion of NUMERIC value '1000000000000000000' to a NUMERIC field .

Сакраментальный вопрос: Кто виноватЪ? Что делатЪ?

_________________
"Helo, word!" - 17 errors 56 warnings
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #32976544
Фотография Ex_Soft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
сорри... забыл-недоглядел :(
numeric(4,2) - это ж 99.99, а не 9999.99

money тоже заборол:
Код: plaintext
1.
cmd.Parameters.Add("@FMoney",OleDbType.Currency).Value= 922337203685477 .5807m; // т.е. decimal ната

осталось тока записать данные с десятичной частью:
на
Код: plaintext
1.
cmd.Parameters.Add("@FNumeric_4_2",OleDbType.Numeric).Value= 99 . 99 ;
OleDbException.Message
[Native Error code: 241]
[DataDirect ADO Sybase Provider] Scale error during implicit conversion of NUMERIC value '99.99' to a NUMERIC field.

целое - пишет, а фот 99.99 - не хочет...
типами баловался (пробовал OleDbType.Decimal), 99.99 к decimal'у приводил - шо мертвому припарки... Ж8-/
вагон бубнов пАлАмАл

Как же, все-таки, записать-передать десятичное (валидное по типу) значение в numeric(precision, scale) (decimal(precision, scale))

_________________
"Helo, word!" - 17 errors 56 warnings
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #32976764
Фотография Ex_Soft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Таки заборол:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
SPResult=cmd.Parameters.Add("@FNumeric_4_2",OleDbType.Numeric);
SPResult.Precision= 4 ;
SPResult.Scale= 2 ;
SPResult.Value= 99 . 99 ;
SPResult=cmd.Parameters.Add("@FNumeric_4_2_out",OleDbType.Numeric);
SPResult.Precision= 4 ;
SPResult.Scale= 2 ;
SPResult.Direction=ParameterDirection.Output;

но это ж изврат!!! Ж8-/
а если структура БД поменяется???

"...Вот уроды..." х/ф "Брат-2" (c)
_________________
"Helo, word!" - 17 errors 56 warnings
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #32989618
Alexander Kadirov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
А ты структуру базы бери из базы:
Код: plaintext
1.
2.
SELECT * FROM INFORMATION_SCHEMA.COLUMNS C
JOIN INFORMATION_SCHEMA.TABLES T ON T.TABLE_NAME=C.TABLE_NAME
ну и т.д.
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #32989634
__guest
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
2 Alexander Kadirov

Можно поподробнее, как для SyBase ASE 12.5 это будет выглядеть ???
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #32989797
Alexander Kadirov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
__guest2 Alexander Kadirov

Можно поподробнее, как для SyBase ASE 12.5 это будет выглядеть ???

А вот для sybase, хрен его знает. Не изучал.
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #32989855
__guest
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Жаль :(
Вопрос (и весь тред) был именно по SyBase ASE 12.5
---------------------
Как-то странно - отвечу что знаю, а не о чём спрашивают...
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #33009207
Фотография Ex_Soft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Поскольку все выполняется посредством ХП, то все решилось очень красиво посредством OleDbCommandBuilder.DeriveParameters - возвращается все, что необходимо... Остается только заполнить Parameters.Value для тех, у кого ParameterDirection.Input...
_________________
"Helo, word!" - 17 errors 56 warnings
...
Рейтинг: 0 / 0
data types .NET vs OleDb
    #33031970
Фотография Ex_Soft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Вторая часть марлезонского балета

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
create procedure sp_TestTypes_Decimal_10_6  
  @FDecimal_10_6 decimal( 10 , 6 ),  
  @FDecimal_10_6_out decimal( 10 , 6 ) output  
as   
begin  
  declare  
    @RetVal int  
  
  select @FDecimal_10_6_out = @FDecimal_10_6  
  
  select @RetVal= 65535    
   
  return(@RetVal)  
end

create procedure sp_TestTypes_Numeric_10_6  
  @FNumeric_10_6 numeric( 10 , 6 ),  
  @FNumeric_10_6_out numeric( 10 , 6 ) output  
as   
begin  
  declare  
    @RetVal int  
  
  select @FNumeric_10_6_out =@FNumeric_10_6  
  
  select @RetVal= 65535    
   
  return(@RetVal)  
end
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
double
  tmpDoubleIn,
  tmpDoubleOut;

decimal
  tmpDecimalIn,
  tmpDecimalOut;

int
  ReturnValue;

tmpDoubleIn= 13 ;
SQLText="sp_TestTypes_Decimal_10_6";
cmd=cn.CreateCommand();
cmd.CommandType=CommandType.StoredProcedure;
cmd.CommandText=SQLText;
OleDbCommandBuilder.DeriveParameters(cmd);
cmd.Parameters["FDecimal_10_6"].Value=tmpDoubleIn;
cmd.ExecuteNonQuery();
ReturnValue=Convert.ToInt32(cmd.Parameters["RETURN_VALUE"].Value);
if(ReturnValue== 65535 )
{
   tmpDoubleOut=Convert.ToDouble(cmd.Parameters["FDecimal_10_6_out"].Value);
   if(Math.Abs(tmpDoubleIn-tmpDoubleOut)>Double.Epsilon)
   {
      Console.WriteLine("In != Out");
   }
}

SQLText="sp_TestTypes_Numeric_10_6";
cmd.CommandText=SQLText;
OleDbCommandBuilder.DeriveParameters(cmd);
cmd.Parameters["FNumeric_10_6"].Value=tmpDoubleIn;
cmd.ExecuteNonQuery();
ReturnValue=Convert.ToInt32(cmd.Parameters["RETURN_VALUE"].Value);
if(ReturnValue== 65535 )
{
   tmpDoubleOut=Convert.ToDouble(cmd.Parameters["FNumeric_10_6_out"].Value);
   if(Math.Abs(tmpDoubleIn-tmpDoubleOut)>Double.Epsilon)
   {
      Console.WriteLine("In != Out");
   }
}

tmpDecimalIn=13m;
SQLText="sp_TestTypes_Decimal_10_6";
cmd.CommandText=SQLText;
OleDbCommandBuilder.DeriveParameters(cmd);
cmd.Parameters["FDecimal_10_6"].Value=tmpDecimalIn;
cmd.ExecuteNonQuery();
ReturnValue=Convert.ToInt32(cmd.Parameters["RETURN_VALUE"].Value);
if(ReturnValue== 65535 )
{
   tmpDecimalOut=Convert.ToDecimal(cmd.Parameters["FDecimal_10_6_out"].Value);
   if(tmpDecimalIn!=tmpDecimalOut)
   {
      Console.WriteLine("In != Out");
   }
}

SQLText="sp_TestTypes_Numeric_10_6";
cmd.CommandText=SQLText;
OleDbCommandBuilder.DeriveParameters(cmd);
cmd.Parameters["FNumeric_10_6"].Value=tmpDecimalIn;
cmd.ExecuteNonQuery();
ReturnValue=Convert.ToInt32(cmd.Parameters["RETURN_VALUE"].Value);
if(ReturnValue== 65535 )
{
   tmpDecimalOut=Convert.ToDecimal(cmd.Parameters["FNumeric_10_6_out"].Value);
   if(tmpDecimalIn!=tmpDecimalOut)
   {
      Console.WriteLine("In != Out");
   }
}

передаю, как видите 13 , а получаю взад 0.000013
(как для double, так и для decimal). Каких @#$% ему еще не хватает? Что еще ната покрутить-подкрутить?

_________________
"Helo, word!" - 17 errors 56 warnings
...
Рейтинг: 0 / 0
9 сообщений из 9, страница 1 из 1
Форумы / ADO.NET, LINQ, Entity Framework, NHibernate, DAL, ORM [игнор отключен] [закрыт для гостей] / data types .NET vs OleDb
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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