Advertisement
4_2005-2006 Databases/ Data Access/ DAO/ ADO #149704

Avoiding use of null

How do you avoid the "Invalid use of null" error when reading null values from a database?If you try to retrieve a null value (empty field) from a database, you will get the error: "Invalid use of Null". Here is one way to get around this problem: ..

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
TextBox.Text = MyTest.Fields("TestFld") & ""
. For example, to create CEdit control, you can do the following:
1) add a member variable m_ec_myedit to your dialog .h file; 
2) I assume that your dialog templete has some control with ID = IDC_ABOVE_DYNAMIC_EDIT, and you want your dynamically created edit control to have the same width and be placed under IDC_ABOVE_DYNAMIC_EDIT. Then add the following code under the call to CDialog::OnInitDialog() in your overriden OnInitDialog(): 
GetDlgItem(IDC_ABOVE_DYNAMIC_EDIT)->GetWindowRect(rect); 
ScreenToClient(rect); 
CRect rectNew(rect.left, rect.bottom+5, rect.right, rect.bottom+35); 
m_myEdit.CreateEx(WS_EX_CLIENTEDGE, "EDIT", NULL 
/*lpszWindowName*/, 
WS_CHILD|WS_VISIBLE|WS_GROUP|WS_TABSTOP|WS_BORDER, rectNew.left, rectNew.top, 
rectNew.Width(), rectNew.Height(), this->GetSafeHwnd(), NULL, NULL); 
m_myEdit.ShowWindow(SW_SHOW); 
It's that simple. The only thing that differs for different control classes is window styles. Usually, you can find the most important of style and extended style constants in online help.

Upload
Původní komentáře (3)
Obnoveno z Wayback Machine