1. An error occurs when reading data. [system. Data. sqlserverce. sqlceexception] = {"cannot generate a keyset cursor for the query because there is an explicit or implicit group by operator.
Because the explicit or implicit group by operator exists, the key set cursor for query cannot be generated. Is it because the group by operator cannot be used in SQL compact queries? The reason for sqlceresultset is found later. If the sqlceresultset type is returned during execution, an error may occur. It may be that command. executeresultset does not support group by. In short, if it is changed to the datatable type, no error will occur.
2. Tab tabcontrol:
Tabcontrolquery. selectedindex the first value is equal to 0, the second value is equal to 1, and so on...
3. about transferring values
The first method is to implement global variables by defining static variables, but it is best not to use static variables if the variable value needs to be changed frequently.
The second is to pass values by defining constructors and attributes,
// Form1
Form2 m_form = New Form2 ( " Type " );
M_form.m_freceiver = " Freceiver " ;
// Form2
Public String FTYPE {Get;Set;}
Public String M_freceiver {Get;Set;}
Public Form2 ( String P_strtype)
{
Initializecomponent ();
FTYPE=P_strtype;
}
The third method is to pass this. dialogresult = dialogresult. OK to determine the value.
// Form2
Public String M_userid { Get ; Set ;}
M_userid = " User "
This . Dialogresult = Dialogresult. OK;
// Form1
Public String M_freceiver { Get ; Set ;}
Form2 m_form = New Form2 ();
If (Form2.showdialog () = Dialogresult. OK)
{
M_freceiver = Form2.m _ userid;
Userquery. Dispose ();
}
The second and third types of projects are used in most cases, and the delegate is rarely used.
4. Data insertion: when data is inserted, an exception occurs when ntext fields are inserted when the data size is large, however, it was found that the data could be saved during data synchronization. At last, my colleague helped solve the problem by adding the parameter and specifying the type,
Sqlce. Parameters. Add ( " @ Fcontent " , P_strdetialinfo );
Sqlce. Parameters [ " Fcontent " ]. Sqldbtype = Sqldbtype. ntext;
The type must be specified after the parameter is added. Otherwise, an error occurs.