Unix Technical Forum

Problem with CCommand::Open when query str is too long.

This is a discussion on Problem with CCommand::Open when query str is too long. within the SQL Server forums, part of the Microsoft SQL Server category; --> I'm using OLE DB model to insert long texts into ntext field. My code looks like : == BOOL ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 12:52 PM
TheOne
 
Posts: n/a
Default Problem with CCommand::Open when query str is too long.

I'm using OLE DB model to insert long texts into ntext field.
My code looks like :

==
BOOL COleDBRowData::Execute(CString strSQL)
{
if(!m_bIsOpen)
return FALSE;

CCommand<CNoAccessor, CNoRowset> rs;

HRESULT hr = rs.Open(m_session, strSQL);

if(FAILED(hr))
return FALSE;

rs.Close();
return TRUE;
}
==
When strSQL length is over 5127XX bytes, Open function fails. Is the
function supposed to be so? Is there any suggestion that I can avoid
this failure? I'm new to OLE DB thing.

What is better is if somebody can tell me SQL command to insert a whole
text file content into the field directly. The sql command that I'm
currently using is
==
INSERT INTO MyTable(Idx, Value) Values(N'{index}', N'{loooooong
text}')
==

Please help this poor soul. Thanks.

--
Daewon YOON

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 12:52 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Problem with CCommand::Open when query str is too long.

TheOne (daewon.yoon@gmail.com) writes:
> I'm using OLE DB model to insert long texts into ntext field.
> My code looks like :
>
>==
> BOOL COleDBRowData::Execute(CString strSQL)
> {
> if(!m_bIsOpen)
> return FALSE;
>
> CCommand<CNoAccessor, CNoRowset> rs;
>
> HRESULT hr = rs.Open(m_session, strSQL);
>
> if(FAILED(hr))
> return FALSE;
>
> rs.Close();
> return TRUE;
> }
>==
> When strSQL length is over 5127XX bytes, Open function fails. Is the
> function supposed to be so? Is there any suggestion that I can avoid
> this failure? I'm new to OLE DB thing.
>
> What is better is if somebody can tell me SQL command to insert a whole
> text file content into the field directly. The sql command that I'm
> currently using is
>==
> INSERT INTO MyTable(Idx, Value) Values(N'{index}', N'{loooooong
> text}')
>==


I believe that for writing LOB data, it's better to use streams.
I can't really give an example, because I have not used it myself,
and I have never used the consumer templates, only the bare OLE DB
API.

--
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:23 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com