.NETGURU
ADO Command
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-sqlclient' list.


Didier Marin
-- Moved from [aspngfreeforall] to [ngfx-sqlclient] by Tim Musschoot <Click here to reveal e-mail address> --

Hi all,

Here is a sample, to summarize my problem:

SQL Procedure
CREATE PROCEDURE dbo.myProc
(
@user_id varchar (20) = null,
@start_date datetime = null,
@cc1b text = null
)
as

return 0

cm.CommandText = "myProc"
cm.CommandType = adCmdStoredProc;
cm.Parameters.Append(cm.CreateParameter("returnValue", adInteger,
adParamReturnValue));
cm.Parameters.Append(cm.CreateParameter("@user_id", adVarChar, adParamInput,
20, user_id));

Test #1
cm.Parameters.Append(cm.CreateParameter("@start_date", adDate, adParamInput,
10, start_date));

Test #2
cm.Parameters.Append(cm.CreateParameter("@start_date", adDate,
adParamInput));
cm("@start_date") = start_date;

cm.Execute(null, null, adExecuteNoRecords);

Each time I add the line test #1 or #2, I have the following error.

Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
[Microsoft][ODBC SQL Server Driver]Optional feature not implemented

Error at the cm.Execute line. Everything works as long as I don't append the
datetime parameter. How do append a parameter of type datetime?
Any idea?

Also,
command.CreateParameter (Name, Type, Direction, Size, Value)
The doc says that the size is optional. how can I not give a size for the
SQL type text, as I don't want to put limitation

cm.Parameters.Append(cm.CreateParameter("@myText", adLongVarChar,
adParamInput, , myText));
or
cm.Parameters.Append(cm.CreateParameter("@myText", adLongVarChar,
adParamInput, null, myText));
or
cm.Parameters.Append(cm.CreateParameter("@myText", adLongVarChar,
adParamInput));
cm("@myText") = myText;

Thank you

Reply to this message...
 
    
Arief Budimartoyo
Didier,

It works fine when i allways using this code :

cm.Parameters.Add(new SqlParameter("@dt", SqlDbType.DateTime));
cm.Parameters["@dt"].Value = Convert.ToDateTime(message["dt"].ToString());

hth,

-----Original Message-----
From: Didier Marin [mailto:Click here to reveal e-mail address]
Sent: Thursday, July 18, 2002 2:16 AM
To: ngfx-sqlclient
Subject: [ngfx-sqlclient] ADO Command

-- Moved from [aspngfreeforall] to [ngfx-sqlclient] by Tim Musschoot
<Click here to reveal e-mail address> --

Hi all,

Here is a sample, to summarize my problem:

SQL Procedure
CREATE PROCEDURE dbo.myProc
(
@user_id varchar (20) = null,
@start_date datetime = null,
@cc1b text = null
)
as

return 0

cm.CommandText = "myProc"
cm.CommandType = adCmdStoredProc;
cm.Parameters.Append(cm.CreateParameter("returnValue", adInteger,
adParamReturnValue));
cm.Parameters.Append(cm.CreateParameter("@user_id", adVarChar, adParamInput,
20, user_id));

Test #1
cm.Parameters.Append(cm.CreateParameter("@start_date", adDate, adParamInput,
10, start_date));

Test #2
cm.Parameters.Append(cm.CreateParameter("@start_date", adDate,
adParamInput));
cm("@start_date") = start_date;

cm.Execute(null, null, adExecuteNoRecords);

Each time I add the line test #1 or #2, I have the following error.

Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
[Microsoft][ODBC SQL Server Driver]Optional feature not implemented

Error at the cm.Execute line. Everything works as long as I don't append the
datetime parameter. How do append a parameter of type datetime?
Any idea?

Also,
command.CreateParameter (Name, Type, Direction, Size, Value)
The doc says that the size is optional. how can I not give a size for the
SQL type text, as I don't want to put limitation

cm.Parameters.Append(cm.CreateParameter("@myText", adLongVarChar,
adParamInput, , myText));
or
cm.Parameters.Append(cm.CreateParameter("@myText", adLongVarChar,
adParamInput, null, myText));
or
cm.Parameters.Append(cm.CreateParameter("@myText", adLongVarChar,
adParamInput));
cm("@myText") = myText;

Thank you

| [ngfx-sqlclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-sqlclient.asp = JOIN/QUIT

Reply to this message...
 
 
System.Convert
System.Data.SqlClient.SqlParameter
System.Data.SqlDbType




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification