Friday, March 26, 2010

DW stored procedure issues

Need help passing date value to a datetime field in SQL



When using the COMMAND function within DW, i select my Stored
Procedure

It lists all the variables below and it expects a size for
each..

So what am i doing wrong or what can i do to resolve this
issue?



here is the error i receive:

---------------------------------

ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current
operation.



/Field/GRATS_Console/adm_con/emp_h.asp, line 65

-------------------------------------------------

Here is the code that is calling the SP



%26lt;%

set com = Server.CreateObject(''ADODB.Command'')

com.ActiveConnection = MM_has_STRING

com.CommandText = ''dbo.emp_insert_new_hire''

com.Parameters.Append com.CreateParameter(''@cid'', 3,
1,6,com__cid)

**LINE 65**com.Parameters.Append
com.CreateParameter(''@cdateh'', 135,

1,10,com__cdateh)

com.Parameters.Append com.CreateParameter(''@dob'', 135,
1,10,com__dob)

com.Parameters.Append com.CreateParameter(''@gen'', 200,
1,5,com__gen)

com.Parameters.Append com.CreateParameter(''@hiredate'', 135,

1,10,com__hiredate)

com.Parameters.Append com.CreateParameter(''@startdate'', 135,

1,10,com__startdate)

com.Parameters.Append com.CreateParameter(''@jobid'', 200,
1,10,com__jobid)

com.CommandType = 4

com.CommandTimeout = 0

com.Prepared = true

setcom.Execute

%%26gt;

--

Using ASP, SQL2005 and DW8





DW stored procedure issues
Is it possible to pass the date in datetime format as SQL is
expecting it?



5/11/2007 2:08:08 PM



The form field is a textfield which is 12 characters long and
allows 10

characters

We wanted to capture a start and end date in MM/DD/YYYY
format...





--

Using ASP, SQL2005 and DW8

''Daniel'' %26lt;dan_c@h.com%26gt; wrote in message

news:f22p0t$rb5$1@forums.macromedia.com...

%26gt; Need help passing date value to a datetime field in SQL

%26gt;

%26gt; When using the COMMAND function within DW, i select my
Stored Procedure

%26gt; It lists all the variables below and it expects a size
for each..

%26gt; So what am i doing wrong or what can i do to resolve
this issue?

%26gt;

%26gt; here is the error i receive:

%26gt; ---------------------------------

%26gt; ADODB.Command error '800a0d5d'

%26gt; Application uses a value of the wrong type for the
current operation.

%26gt;

%26gt; /Field/GRATS_Console/adm_con/emp_h.asp, line 65

%26gt; -------------------------------------------------

%26gt; Here is the code that is calling the SP

%26gt;

%26gt; %26lt;%

%26gt; set com = Server.CreateObject(''ADODB.Command'')

%26gt; com.ActiveConnection = MM_has_STRING

%26gt; com.CommandText = ''dbo.emp_insert_new_hire''

%26gt; com.Parameters.Append com.CreateParameter(''@cid'', 3,
1,6,com__cid)

%26gt; **LINE 65**com.Parameters.Append
com.CreateParameter(''@cdateh'', 135,

%26gt; 1,10,com__cdateh)

%26gt; com.Parameters.Append com.CreateParameter(''@dob'', 135,
1,10,com__dob)

%26gt; com.Parameters.Append com.CreateParameter(''@gen'', 200,
1,5,com__gen)

%26gt; com.Parameters.Append com.CreateParameter(''@hiredate'',
135,

%26gt; 1,10,com__hiredate)

%26gt; com.Parameters.Append com.CreateParameter(''@startdate'',
135,

%26gt; 1,10,com__startdate)

%26gt; com.Parameters.Append com.CreateParameter(''@jobid'', 200,
1,10,com__jobid)

%26gt; com.CommandType = 4

%26gt; com.CommandTimeout = 0

%26gt; com.Prepared = true

%26gt; setcom.Execute

%26gt; %%26gt;

%26gt; --

%26gt; Using ASP, SQL2005 and DW8

%26gt;





DW stored procedure issues


''Daniel'' %26lt;dan_c@h.com%26gt; wrote in message

news:f22pmc$s6g$1@forums.macromedia.com...

%26gt; Is it possible to pass the date in datetime format as
SQL is expecting it?

%26gt;

%26gt; 5/11/2007 2:08:08 PM

%26gt;

%26gt; The form field is a textfield which is 12 characters
long and allows 10

%26gt; characters

%26gt; We wanted to capture a start and end date in MM/DD/YYYY
format...



The size on DATETIME is 8, not 10. The size for SMALLDATETIME
is 4.

Timestamp (type 135) is correct. SQL Server often silently
converts strings

to dates; I would think that ADO does the same here,
especially since it

will convert strings to numbers as necessary.



If you have trouble getting it to work, just pass the date in
as a string

(type 200), but keep your stored procedure parameter as
DATETIME and let SQL

Server do the conversion from one to the other.





  • scar cream
  • No comments:

    Post a Comment