Solved

ADO Stored Procedure date or/and datetime  parameters passing problem

Posted on 2004-04-19
2
886 Views
Last Modified: 2010-04-16
i  m using sql server 2000 standart edit. and delphi 7.
i have a stored procedure.
This stored procedures requisting a datetime parameter for input.

Procedure:
-------------------------------------------------------------------------------------------------
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

ALTER PROCEDURE [dbo].[GIrsSor]
@IrsNo varchar(12)='',

@IrsBasTarihi varchar(50)=null

AS
declare @IrsTarihi datetime
declare @sql varchar(1000)
declare @sqlw varchar(1000)

set @sql=''
set @sqlw=''
set @sql='SELECT GM.IrsSeri,GM.IrsNo,GM.MusKodu,GM.IrsTarihi,GM.SysTarihi,GM.Tipi,GD.Brm1,GD.Mk1,GD.LotNo,GD.RafNo,GD.Pus,GD.Fayn,GD.Varyant,GD.HamEn,
  GD.HamGramaj,GD.MusSipNo,GD.TPartiNo,GD.Denye,Kod3.Adi AS MusAdi,Kod2.Adi AS Kod2Adi,Kod.Adi MlzAdi,FisTuru.Adi AS FisTuruAdi
  FROM GIrsM GM inner JOIN GIrsD GD ON GM.IrsSeri=GD.IrsSeri AND GM.IrsNo=GD.IrsNo AND GM.MusKodu=GD.MusKodu LEFT OUTER JOIN
  Kod3 ON GM.MusKodu=Kod3.Kodu LEFT OUTER JOIN NurUretim.dbo.Kod2 Kod2 ON GD.MlzKod2=Kod2.Kodu LEFT
  OUTER JOIN NurUretim.dbo.Kod Kod ON GD.MlzKodu=Kod.Kodu LEFT OUTER JOIN NurUretim.dbo.FisTuru FisTuru ON GD.FisTuruKodu=FisTuru.Kodu
  where GM.IrsNo<>""'

if @IrsNo<>''
  set @sqlw=@sqlw+' and (GM.IrsNo='+@IrsNo+')'

if @IrsBasTarihi<>null
begin
  set @IrsTarihi=convert(datetime,@IrsBasTarihi,0)
  set @sqlw=@sqlw+' and (GM.IrsTarihi>='+@IrsTarihi+')'
end

exec(@sql+@sqlw)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
----------------------------------------------------------------------------------------------

i giving parameter value for @IrsBasTarihi date,datetime or stringtodatetime(a valid string value) to adostoredprocedure component on ADO tab, but this parameters values
doesnt working.
Please help me.


Osman TASKIRAN
osmantaskiran@nuryildiz.com.tr
icq=101243522

0
Comment
Question by:osmantaskiran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 10866295
your @IrsBasTarihi is a varchar, so you must provide a string there

--> provide a datestring here in the format yyyy/mm/dd

meikl ;-)
0
 

Author Comment

by:osmantaskiran
ID: 10868972
i was resolve this problem with
@IrsBasTarihi varchar(25)
and
i was give this parameter value 'mm/dd/yyyy' string value.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question