Solved

ADO Stored Procedure date or/and datetime  parameters passing problem

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

12 Experts available now in Live!

Get 1:1 Help Now