SQL Server 2000 Windows CE version - C ++ programming (reposted)

xiaoxiao2021-03-06  171

SQL Server 2000 Windows CE version - C programming applies to: Windows ce 3.0 http://www.microsoft.com/china/windows/embedded/community/tips/ce/sqlserforce.asp

Release Date: September 26, 2003

Related connection

Submit to the Windows Embedded Community

Contributed by: Embedded MVP, Abraham Kcholi Microsoft SQL ServerTM 2000 for Windows® CE is a handful gadget. However, the help content provided by C developers is more confusing. When we start using the object link provided by SQL Server CE and the embedded database (OLEDB), it usually views the relevant examples, and feels the heart; however, when we try to create an example for ordinary users, it will encounter To some binding problems. A solution that can help overcome binding problems will be provided below.

Get data from the RowSet object to get information about the column in the line collection hr = m_pirowset-> queryinterface (IID_ICOLUMNSINFO, (Void **) & picolinfo);

HR = Picolinfo-> getColumnInfo (& Ccol, & Pcolinfo, & PStringBuffer);

Use the above information to create a binding (DBBINDING), while DBBINDING represents the specific method of actual data in the row collection column to the user buffer. Important: Before you use DBColumnInfo (a structure corresponding to each column in the row collection), check the number of columns (& ccol). This is mainly because the above columns may contain bookmarks, and information related to the bookmarks is the first structure of the DBColumnInfo array. To this end, information should be started from the second element of the returned array. For (ICOL = 0; ICOL

{

Pbinding [icol] .iordinal = pcolinfo [icol 1] .iordinal

PBINDING [ICOL] .dwpart = dbpart_value | dbpart_length | dbpart_status;

PBINDING [ICOL] .EPARAMIO = 0;

PBINDING [ICOL] .wtype = pcolinfo [iCol 1] .wtype;

PBINDING [ICOL] .ptypeinfo = Pcolinfo [ICOL 1] .ptypeinfo;

PBINDING [ICOL] .pobject = NULL;

PBINDING [ICOL] .obvalue = dwoffset offsetof (Coldata, BDATA);

Pbinding [iCol] .OBLENGTH = DWOFFSET OFFSETOF (Coldata, DWLENGTH);

Pbinding [iCol] .Obstatus = dwoffset offsetof (Coldata, DWSTATUS);

PBINDING [ICOL] .cbmaxlen = Pcolinfo [ICOL 1] .ulcolumnsize sizeof (Ulong);

PBINDING [ICOL] .dwflags = pcolinfo [ICOL 1] .dwflags; pbinding [icol] .dwMemowner = dbmemowner_clientowned;

PBINDING [ICOL] .pbindext = NULL;

Dwoffset = pbinding [icol] .cbmaxlen offsetof (Coldata, BDATA);

Pass the bind to the RowSet object and pick up the access program handle. The above prompts and techniques are for reference only, and the purpose is limited to providing readers. All risks or consequences with the above tips and techniques should be borne by the user.

转载请注明原文地址:https://www.9cbs.com/read-128345.html

New Post(0)