how get rid of the null character in a BSTR string?
-
-
Hi All, I have a BSTR string variable via ADO Recordset Getstring method. In the BSTR string has null character('\0'). How can I get rid them of in a common way(Of course I can loop from start of BSTR, but I want a directly way). Thank you. ;P chenzhu
Hello, the codegurus around the world.;) In fact, I don't understand your question a little bit. Do you want to take off "NULL" word from Column (display)? Or do you want to take off '\0' from all strings in Column? Or I miss something?:confused: Have a nice day! -Masaaki Onishi-
-
Hello, the codegurus around the world.;) In fact, I don't understand your question a little bit. Do you want to take off "NULL" word from Column (display)? Or do you want to take off '\0' from all strings in Column? Or I miss something?:confused: Have a nice day! -Masaaki Onishi-
Dear Masaaki Onishi, The last effect is my desire. I get a BSTR string has '\t' separator between columns and '\n' between rows. But int the string has excaptional '\0' just before a '\t'. I can not transform it to CString by W2A or WideCharToMultiByte functions directly because these annoying '\0'. Thanks. ;P chenzhu
-
Dear Masaaki Onishi, The last effect is my desire. I get a BSTR string has '\t' separator between columns and '\n' between rows. But int the string has excaptional '\0' just before a '\t'. I can not transform it to CString by W2A or WideCharToMultiByte functions directly because these annoying '\0'. Thanks. ;P chenzhu
Hello, the codegurus around the world.;) Do you try to use ADO in MFC or COM(ActiveX)?:confused: If you use ADO in MFC, we can use DataGrid control and this member function to display the data. As a result, we don't need to care about each data string. I often use Datagrid for ADO in MFC. Actually, MSDN has a good example called AdoDataGrid(?). However, if you want to use CListView or something to display your data, you may need to work your problem.:confused: Anyway, I want to sleep now. So, someone migh help you, or if I have a time.... Have a nice day! -Masaaki Onishi-
-
Hello, the codegurus around the world.;) Do you try to use ADO in MFC or COM(ActiveX)?:confused: If you use ADO in MFC, we can use DataGrid control and this member function to display the data. As a result, we don't need to care about each data string. I often use Datagrid for ADO in MFC. Actually, MSDN has a good example called AdoDataGrid(?). However, if you want to use CListView or something to display your data, you may need to work your problem.:confused: Anyway, I want to sleep now. So, someone migh help you, or if I have a time.... Have a nice day! -Masaaki Onishi-
Dear Masaaki Onishi, Thank you very much. Yes, I want a control to display the data. Actualy I am making a ATL control and the ATL control hold one Grid that accept format string in that pattern. The common usage is a VB project, which is the client of ATL COM control, opens one database and get one recordset, and then pass it into ATL control. Of course I can loop through whole recordset, read variant from every fields and assemble a CString by myself, but that is too tiresome. If you have waked up now has have a good mood, give me a advice. thank you. chenzhu :-O