ADO Command->CommandText length 
Author Message
 ADO Command->CommandText length

Hi all!

I have a problem with length of CommandText parameter. When I try to
assign to Command->CommandText CString value (length 950 characters) I
got a message:
"String or binary data would be truncated!!!"

Can anobody tell me why this don't work? Sholud I generate sql command
with different type (not CString)?

Thanks,
Manuel

SAMPLE:

CString sql;
....
//generate sql insert (sql has 950 characters)
...
try {
  pCmd->CommandText=_bstr_t(sql);
 }
 catch(_com_error &e) {
  MessageBox(e.Description());
 }



Mon, 16 Sep 2002 03:00:00 GMT
 ADO Command->CommandText length

Hi again!

I've been testing this problem at 2 different NT servers with installed
SQLServer 7.0. At one server everything is OK, but at another I still have
a problem. I was thinking that problem is in my application, but now I
think that maybe is problem at server side (installation of SQLServer
components). Should I install something else (?MDAC) at server-side?

Thanks,
 Manuel

Quote:

> Hi all!

> I have a problem with length of CommandText parameter. When I try to
> assign to Command->CommandText CString value (length 950 characters) I
> got a message:
> "String or binary data would be truncated!!!"

> Can anobody tell me why this don't work? Sholud I generate sql command
> with different type (not CString)?

> Thanks,
> Manuel

> SAMPLE:

> CString sql;
> ....
> //generate sql insert (sql has 950 characters)
> ...
> try {
>   pCmd->CommandText=_bstr_t(sql);
>  }
>  catch(_com_error &e) {
>   MessageBox(e.Description());
>  }



Tue, 17 Sep 2002 03:00:00 GMT
 ADO Command->CommandText length
The -> CommandText is of type BSTR. You should not use CStrings for that...


Quote:
> Hi all!

> I have a problem with length of CommandText parameter. When I try to
> assign to Command->CommandText CString value (length 950 characters) I
> got a message:
> "String or binary data would be truncated!!!"

> Can anobody tell me why this don't work? Sholud I generate sql command
> with different type (not CString)?

> Thanks,
> Manuel

> SAMPLE:

> CString sql;
> ....
> file://generate sql insert (sql has 950 characters)
> ...
> try {
>   pCmd->CommandText=_bstr_t(sql);
>  }
>  catch(_com_error &e) {
>   MessageBox(e.Description());
>  }



Tue, 17 Sep 2002 03:00:00 GMT
 ADO Command->CommandText length
Manuel,

You might have a different database compatibility level.
Check out:
sp_dbcmptlevel
SET ANSI_WARNINGS

--
Tibor Karaszi, Cornerstone Sweden AB
MCDBA, MCSE, MCSD, MCT, SQL Server MVP
Please reply to the newsgroup only, not by email.


Quote:
> Hi again!

> I've been testing this problem at 2 different NT servers with installed
> SQLServer 7.0. At one server everything is OK, but at another I still have
> a problem. I was thinking that problem is in my application, but now I
> think that maybe is problem at server side (installation of SQLServer
> components). Should I install something else (?MDAC) at server-side?

> Thanks,
>  Manuel


> > Hi all!

> > I have a problem with length of CommandText parameter. When I try to
> > assign to Command->CommandText CString value (length 950 characters) I
> > got a message:
> > "String or binary data would be truncated!!!"

> > Can anobody tell me why this don't work? Sholud I generate sql command
> > with different type (not CString)?

> > Thanks,
> > Manuel

> > SAMPLE:

> > CString sql;
> > ....
> > file://generate sql insert (sql has 950 characters)
> > ...
> > try {
> >   pCmd->CommandText=_bstr_t(sql);
> >  }
> >  catch(_com_error &e) {
> >   MessageBox(e.Description());
> >  }



Tue, 17 Sep 2002 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. ADO Command->CommandText length

2. ADO Command->CommandText length

3. Command.CommandText max length ??

4. ADO, Command, CommandText, String Limit

5. Does cmd.CommandText have a maximum length?

6. ADO Recordset->Open vs Command->Execute

7. ADO Command->Properties->Item[]...

8. dataEnvironment Command CommandText requery

9. SQL 7.0 / ADO / VB / CommandText / Prepared=True / Bug

10. ado commandtext property

11. ADO, Datagrid, Refresh after change Commandtext

12. Can't reset commandtext for recordset in dataenvironment using ADo


 
Powered by phpBB® Forum Software