|
|
|
Forum Guru
      
участник
Last Login: 17.08.2005 11:05
Сообщ.: 60,
Visits: 661
|
|
Из VB6 я делаю запрос в Оракл с параметрами,
там где параметр числовой и обращается к числовому полю - все
работает, а со строчными переменными проблема, они еще и состоят из
чисел.
cmd.CommandText = " SELECT Sum(ttfgld106001.t$amth), ttfgld106001.t$otyp, ttfgld106001.t$leac From ttfgld106001 Where ttfgld106001.t$oyer = 2004 and ttfgld106001.t$otyp = " & t & " and ttfgld106001.t$dbcr = 2 and ttfgld106001.t$leac = '60-02-000' and ttfgld106001.t$catg = 10 and ttfgld106001.t$osrl = 118 GROUP BY ttfgld106001.t$otyp, ttfgld106001.t$leac "
Не выберает ничего и все! а если явно указыва переменную, то все ок
|
|
|
|
|
Supreme Being
      
участник
Last Login: 06.05.2006 8:46
Сообщ.: 244,
Visits: 2 687
|
|
А где тут параметры? Может в VB они как то по особенному пишутся, но в Оракле это вроде выглядит как field=:param.
Может у тебя не параметры, а макроподстановка?
|
|
|
|
|
новичок
      
участник
Last Login: 16.06.2005 14:03
Сообщ.: 2,
Visits: 23
|
|
если ttfgld106001.t$otyp - строчное поле, поставь одинарные кавычки
cmd.CommandText = " SELECT Sum(ttfgld106001.t$amth), ttfgld106001.t$otyp, ttfgld106001.t$leac From ttfgld106001 Where ttfgld106001.t$oyer = 2004 and ttfgld106001.t$otyp = '" & t & "' and ttfgld106001.t$dbcr = 2 and ttfgld106001.t$leac = '60-02-000' and ttfgld106001.t$catg = 10 and ttfgld106001.t$osrl = 118 GROUP BY ttfgld106001.t$otyp, ttfgld106001.t$leac "
если ttfgld106001.t$otyp - числовое поле, преобразуй в число
cmd.CommandText = " SELECT Sum(ttfgld106001.t$amth), ttfgld106001.t$otyp, ttfgld106001.t$leac From ttfgld106001 Where ttfgld106001.t$oyer = 2004 and ttfgld106001.t$otyp = to_number('" & t & "') and ttfgld106001.t$dbcr = 2 and ttfgld106001.t$leac = '60-02-000' and ttfgld106001.t$catg = 10 and ttfgld106001.t$osrl = 118 GROUP BY ttfgld106001.t$otyp, ttfgld106001.t$leac "
|
|
|
|