Solved

ADO Stored Procedure date or/and datetime  parameters passing problem

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

735 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