Solved

ADO Stored Procedure date or/and datetime  parameters passing problem

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

Industry Leaders: 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

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…
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 brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month3 days, 17 hours left to enroll

630 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