Wince Remote SQL Server database operation

Source: Internet
Author: User

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

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.