Showing posts with label usign. Show all posts
Showing posts with label usign. Show all posts

Friday, March 30, 2012

Reading a field from Cursor

Hi,
I have a cursor that reads a table. During the reading of the table I want
to read e "field" directly (Not usign FETCH NEXT FROM authors_cursors INTO
@.col1, @.col2).
Thanks!claude81 wrote:
> Hi,
> I have a cursor that reads a table. During the reading of the table I
> want to read e "field" directly (Not usign FETCH NEXT FROM
> authors_cursors INTO @.col1, @.col2).
>
You have to FETCH NEXT INTO. There is no other way.
Cursors should be a last resort.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.|||Thaks!!
"Bob Barrows [MVP]" wrote:

> claude81 wrote:
> You have to FETCH NEXT INTO. There is no other way.
> Cursors should be a last resort.
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

Wednesday, March 28, 2012

read varbinary(max)

Hi,
I'm working with visual c++ and usign MFC ( ODBC ) . I have a problem
with varbinary(max) type of sql server 2005 express. I can read a
varbinary (n ) but when i try to read a varbinary(max) fails.
CDBVariant cvarValor;
m_tablaDeConsulta.GetFieldValue ( campo,
cvarValor );
I use this code to read varbinary fields. The only differrence betwen
max a normal varbinary is the precision. When i read a varbinary
precision is 0.
Someone can help me?
thanks.AKS ha escrito:

> Hi,
> I'm working with visual c++ and usign MFC ( ODBC ) . I have a problem
> with varbinary(max) type of sql server 2005 express. I can read a
> varbinary (n ) but when i try to read a varbinary(max) fails.
> CDBVariant cvarValor;
> m_tablaDeConsulta.GetFieldValue ( campo,
> cvarValor );
> I use this code to read varbinary fields. The only differrence betwen
> max a normal varbinary is the precision. When i read a varbinary
> precision is 0.
> Someone can help me?
> thanks.
At least i can read a varbinary. The code
// get data size
void* buffer = malloc ( 1 );
SQLINTEGER tam = 0;
tam = m_tablaDeConsulta.GetData ( m_tablaDeConsulta.m_pDatabase,
m_tablaDeConsulta.m_hstmt, ind+1, SQL_C_BINARY, buffer, 0, SQL_C_BINARY
);
free (buffer );
// alloc data buffer
CDBVariant cvarValor;
buffer = m_tablaDeConsulta.GetDataBuffer( cvarValor, SQL_C_BINARY,
&tam, SQL_C_BINARY, tam);
// read data
m_tablaDeConsulta.GetData ( m_tablaDeConsulta.m_pDatabase,
m_tablaDeConsulta.m_hstmt, ind+1, SQL_C_BINARY, buffer, tam,
SQL_C_BINARY );