VC中利用ODBC链接access中的问题
2013-12-19 15:57
309 查看
if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength)
我编程的时候,在access中增加一列数据,运行VC,报错,显示上面buf出错,怎么修改。
LPTSTR CString::GetBuffer(int nMinBufLength)
{
ASSERT(nMinBufLength >= 0);
if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength)
{
#ifdef _DEBUG
// give a warning in case locked string becomes unlocked
if (GetData() != _afxDataNil && GetData()->nRefs < 0)
TRACE0("Warning: GetBuffer on locked CString creates unlocked CString!\n");
#endif
// we have to grow the buffer
CStringData* pOldData = GetData();
int nOldLen = GetData()->nDataLength; // AllocBuffer will tromp it
if (nMinBufLength < nOldLen)
nMinBufLength = nOldLen;
AllocBuffer(nMinBufLength);
memcpy(m_pchData, pOldData->data(), (nOldLen+1)*sizeof(TCHAR));
GetData()->nDataLength = nOldLen;
CString::Release(pOldData);
}
ASSERT(GetData()->nRefs <= 1);
// return a pointer to the character storage for this string
ASSERT(m_pchData != NULL);
return m_pchData;
}
我编程的时候,在access中增加一列数据,运行VC,报错,显示上面buf出错,怎么修改。
LPTSTR CString::GetBuffer(int nMinBufLength)
{
ASSERT(nMinBufLength >= 0);
if (GetData()->nRefs > 1 || nMinBufLength > GetData()->nAllocLength)
{
#ifdef _DEBUG
// give a warning in case locked string becomes unlocked
if (GetData() != _afxDataNil && GetData()->nRefs < 0)
TRACE0("Warning: GetBuffer on locked CString creates unlocked CString!\n");
#endif
// we have to grow the buffer
CStringData* pOldData = GetData();
int nOldLen = GetData()->nDataLength; // AllocBuffer will tromp it
if (nMinBufLength < nOldLen)
nMinBufLength = nOldLen;
AllocBuffer(nMinBufLength);
memcpy(m_pchData, pOldData->data(), (nOldLen+1)*sizeof(TCHAR));
GetData()->nDataLength = nOldLen;
CString::Release(pOldData);
}
ASSERT(GetData()->nRefs <= 1);
// return a pointer to the character storage for this string
ASSERT(m_pchData != NULL);
return m_pchData;
}
相关文章推荐
- vc中利用ODBC链接SqlServer数据库
- 利用ADOX创建ACCESS链接表(VC/MFC)
- vc-odbc中定义数据源未见access驱动项的问题
- VC下编译和链接常出现的问题汇总
- 解决VC中图像缩小失真的问题:利用CDC::SetStretchBltMode
- VC 链接Access 数据库 插入变量到表
- 问问MFC中利用ODBC保存数据为Excel的问题!!???
- MySQL的启动问题 (ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO))
- VC下编译和链接常出现的问题汇总
- 转载自〈Compubin的空间〉Debug Assertion Failed! dbcore.cpp line:2979问题解决(VC++用ODBC访问SQLServer)
- 利用VC调用动态链接库中的函数
- C++使用ODBC链接MYSQL出现乱码问题
- VC下利用CADO Class和DataGrid分页显示数据库access内容
- vc++调试---利用PDB和dump文件定位问题并进行调试(VS2010)
- 利用MySQLDriverCS链接MySQL数据库及中文乱码问题
- android中利用瀏覽器來開啟链接中含有中文的網頁问题
- VC运行库版本不同导致链接.LIB静态库时发生重复定义问题的一个案例分析和总结
- vc.net中MFC静态与动态链接问题与release方式编译
- VC ODBC写excel注意的问题,网上找的
- VC下编译和链接常出现的问题汇总