Solved

ADO Stored Procedure date or/and datetime  parameters passing problem

Posted on 2004-04-19
2
879 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now