Reference sqlclient. dll under WinCE
Add dbnetlib. dll
You can operate a remote database at will.
Dbnetlib. dll: http://download.csdn.net/detail/tiz198183/4344983
1. copy and paste dbnetlib. DLL to the vs project.
2. Set the properties of dbnetlib. dll ----- copy to the output directory: If it is newer, copy
View code
Using system; using system. collections. generic; using system. componentmodel; using system. data; using system. drawing; using system. text; using system. windows. forms; using system. data. sqltypes; using system. data. sqlclient; namespace wince remote connection to the database {public partial class form1: FORM {public form1 () {initializecomponent ();} private void form1_load (Object sender, eventargs E) {string sqlstr = "Data Source = 192.168.1.225; database = myoffice; user id = sa; Password = 123"; system. data. sqlclient. sqlconnection conn = new sqlconnection (sqlstr); system. data. sqlclient. sqlcommand cmd = new sqlcommand ("select * From userinfo", Conn); Conn. open (); datatable dt = new datatable (); sqldataadapter da = new sqldataadapter (CMD); DA. fill (DT); datagrid1.datasource = DT ;}}}
Code download
Contains sqlclient and dbnetlib