Afficher un message
Vieux 27/03/2008, 10h19   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: dbrpcparam datalen problem

(guangxiren@gmail.com) writes:
> I have this data binding in the C code:
> char szCounter[1025];
> ...
> pSql->BindCharParam(12,"@Counter",szCounter,TRUE,1024 );
>
> I got a problem regarding the length of the datalen of dbrpcparam when
> I tried to use it for the store procedure call:
> dbrpcparam(..,SQLVARCHAR,..,1024, (BYTE *) szCounter)
>
> When I used 1024 as the datalen, the store procedure call failed, but
> if I changed the datalen to 256:
> dbrpcparam(..,SQLVARCHAR,..,256, (BYTE *) szCounter),
> it worked just fine!
>
> The store procedure:
> declare @Counter varchar(1024)
> ...
> CREATE PROCEDURE ..,@Counter varchar(1024) output, ....


You are using DB-Library which is an outdated and deprecated client API,
and which the version of SQL Server following SQL 2008 will not support.
DB-Library has not been developed since SQL 6.5 was released, and does
not support features added in later versions. In 6.5, a varchar value
could not be longer than 255 characters, and that is what DB-Library
supports.

So you will need to stick with 255 - or change to a different client API.
In fact, if you are doing new development, you should definitely do the
latter. I assume, though, that you are working with old code.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
 
Page generated in 0,05864 seconds with 9 queries