PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > dbrpcparam datalen problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
dbrpcparam datalen problem

Réponse
 
LinkBack Outils de la discussion
Vieux 27/03/2008, 07h55   #1
guangxiren@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut dbrpcparam datalen problem

Hi, there

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, ....

The databse is MSSQL.

Thanks!

Zhiyong Lu
guangxiren@gmail.com
  Réponse avec citation
Vieux 27/03/2008, 09h19   #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
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h20.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07237 seconds with 10 queries