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




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com