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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| ||||
| 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 |