我最近用MFC里面的CRecordset类从SQLSERVER里面取数据,可是当从一部分字段里面取数据的时候出现异常提示说:“数据被截断!”,可是从ACCESS里面取数据就没有这种问题。
请问:
1、这是不是ODBC本身的问题?
2、如果我想仍然用ODBC有没有方法解决?
3、如何解决?
4、如果用ODBC解决不了,有什么其他更好的办法?
谢谢!
我知道高手都不太在乎送高分,不过我还是会送的!
再次感谢!
请问:
1、这是不是ODBC本身的问题?
2、如果我想仍然用ODBC有没有方法解决?
3、如何解决?
4、如果用ODBC解决不了,有什么其他更好的办法?
谢谢!
我知道高手都不太在乎送高分,不过我还是会送的!
再次感谢!
解决方案 »
- 关于minidump的问题,麻烦高手看一下,小弟先给大家谢了
- 在鼠标的全局钩子里面用了一个::MessageBox( NULL, "您单击了鼠标右键", "注意", MB_OK ),怎么会一个一个的冒出10几个对话框来?
- 怎样让工具栏按钮显示提示信息?
- CreateCompatibleBitmap
- 关于成批处理菜单消息。。。
- windows中消息标识在哪能找到,如WM_CLICK为 HF5,那WM_MOUSEMOVE呢
- 如何对多幅图像进行相关操作???急急!
- 如何修改ProgID
- 请问MFC dll如何输出函数?
- 请问谁现在正在看《com本质论》和《com原理及应用》?????
- 大家帮我看看,为什么我的这个消息退不出来?
- 视图类中怎么使用计时器?
你看看在记录集的.cpp文件里默认的
RFX_Date(pFX, _T("[field]"), m_field);改为RFX_Date(pFX, _T("[field]"), m_field,5000);//
--------------------------------------------------------------------------------
The information in this article applies to:Microsoft Visual C++, 32-bit Editions, version 6.0--------------------------------------------------------------------------------
SYMPTOMS
When trying to move to record in a wizard-generated recordset, the following error can occur:Data truncated.
You may also see the following TRACE message in the debug output window:
Error: field data truncated during data fetch. CAUSE
This error occurs when you are trying to access data in a text field that contains more than 255 characters. If you use the AppWizard or ClassWizard to generate your recordset class, the wizard creates a call to the function RFX_Text to transfer data between the database and your member variable. The fourth parameter of this function specifies the maximum allowed length of the data being transferred and the default value of this parameter is 255. RESOLUTION
For each call to RFX_Text where the field can contain more than 255 characters, add a fourth parameter that is equal to the maximum length of that field. STATUS
This behavior is by design. MORE INFORMATION
Use the AppWizard to create a new MFC project with database support. Use an ODBC data source that contains one or more text fields with data longer than 255 characters.NOTE: When you build the project and run it, you may see the above error when you try to move to a record that contains long data in the text field. You can see it as soon as the recordset opens, if the first record meets this criteria.
谢!