"Project summary based on winform+access LAN shared database" Article III: Access remote connection database and form package deployment

Source: Internet
Author: User
Tags how to use ftp connectionstrings mstsc visual studio installer

Article One: WinForm Development general overview and technology realization

Chapter Two: WinForm Development Sector Graph statistics and Excel data export

Article Three: Access remote connection database and form packaging deployment

"Xiao Kee": recently completed a legal consulting management system based on the Winform+access database. The system requires similar background management effect, and based on the LAN, the completion of multi-client operation of the same database, according to different permissions to perform different functional modules. The core modules are Cascade statistic type management, database consulting data sector statistic, tree operation, consulting data management, handwritten paging, Excel data export, multi-user operation server data and so on. and support multi-user simultaneous operation, remote connection to the database and the data IP information modification. In the development process, especially the requirements of the interface and after-the-fact multi-user operation is somewhat cumbersome. Since then, the project has been fully delivered and then summarized. The entire framework is still understood, and the core knowledge is analyzed one by one to facilitate the sharing of two development and required programmers.

Article Three: Access remote connection database and form packaging deployment

"Opening" chapter overview

First, access implements a remote connection database

Problems encountered and solutions: Many earlier, most of which had been developed using Oracle and server MySQL, although Access database development was used. But the remote configuration is still the first time, so you start to encounter tricky issues. So how do you achieve remote results if you configure the database?

The first idea: Configure the server with FTP, other clients access my IP address and port. Then download a simple FTP software to upload the local database. You are having trouble connecting to the database and cannot access this file. In principle it is possible, and later the project summary found itself locally configured, plus the SQL connection statement. Cause the cause of the problem. Then the second idea was adopted.

Second idea: Use VPN for LAN access, and then connect to shared folders. So the VPN configuration (VPN configuration, file sharing, remote settings and other information will then be in the technical carding specific deployment), after the configuration is complete, shared files, installation of the client program is still unable to implement the connection. Then after several toss decided to adopt a third way of thinking.

The third idea: the direct use of remote connection database, in the server shared file configuration IP address, early or not realize the effect of LAN sharing. Later to solve, how to solve the subsequent summary of the combination of VPN failure to compare analysis.

The above three kinds of ideas, finally achieve the remote effect, as follows:

Above problem analysis:

1, first solve the remote sharing, how to connect successfully?

The premise is the remote connection of the database in the LAN, then the server for data file sharing, how to ensure the security of the file later introduced. Then access the IP address, the IP address can be changed, because if the server is stable and fair. The client server I met was a local laptop, and the IP address could change at any time when the network was connected, or when the server was replaced. IP address Flexibility is important, so do not write dead. But the problem arises, and many people may start to encounter the problem of IP address preservation. I did not finally find a better solution, just write the database connection statement in the config file, and then save it to the local disk. This modifies the IP time, which is saved locally on the server.

2, how to control the database file security?

Security problem has been one of the most concerned about the programmer, because I targeted the customer is the same company, more than 10 people operate, basically do not understand software technology, and have common interests, will not open up, benefit distribution on the security play a certain role. So do some simple operation can, but in the face of more users, how to better improve, we have a good idea to discuss. I use the database encryption directly in the ACCDB file.

3, so remote connection will have hidden trouble?

Because remote connections can view all information about the server, specifically for the server as a local computer. If the Administrator server computer Some privacy, private information, password copy text or you know the video what, encounter female colleague visit, also looks bad not. Therefore, remote connection can solve the problem, but at the same time, your information is not intended to be completely exposed. Based on how to solve it? VPN settings can be used to share the files through the VPN, the connection can be, other non-shared hidden. As for the FTP, I think can achieve the final effect, the author did not try, interested can try.

Second, the form of packaging

1. Select the solution, new project, and other project types, install and deploy->visual Studio installer-> Setup Project, change name and save path

2, 1 in the Application Folder right-click the output file, the main output, OK.

2 Add files again to the Application folder properties and select the ICO format to install and uninstall shortcut pictures separately. Again the same way to find the Mstsc.exe file under C:\Windows\System32, to add.

3 Select Main output, properties, create shortcut, select Mstsc, Properties, create shortcut.

4 in the new project Setup1, press and hold F4 to view the properties, copy the properties in producecode:{e9b10db2-b42a-4ca5-9f12-b419bc939738}

5 Click Uninstall a management system, F4, parameters, x/{e9b10db2-b42a-4ca5-9f12-b419bc939738}. Configure icon image

6 The same way to set up an icon to install a certain management system

7 Application Folder, F4 view properties, [Programfilesfolder][manufacturer]\[productname] delete [manufacturer]

8 Select Build Project Setup Build

"In the article" Knowledge carding

1, how to configure the VPN connection?

VPN server: Go to network Sharing Center, change adapter settings and whether there is a menu bar (no click Alt)--New incoming connection, file--Create a new user---set user name, password--OK next- > Final configuration is complete.

Client Connection: Enter the network Sharing Center, set up a new network and connect to the workspace, next to create a user name, password (similar to a broadband connection) with the IP address of the input connection, use my Inter connection (VPN).

2. How to use FTP?

Two ways: 1. Download a mini FTP server, set the IP address, port number. Select whether login verification is required, and if selected, prompt to set the account password. Test after startup. After the test is successful, you can click Browse to select the build file.

2. Download the FTP software, especially at the time of publishing the website, by entering your domain name space. Then the project in VS is packaged and generated, and the resulting file is uploaded to space.

3. How to set up file sharing?

1 Put the files that need to be shared into a folder, right-click the folder, view share---specific users, click the drop-down box to select Users, click Add, and share the permission level settings

2 Turn on Control Panel, network and internet-> Network and Sharing Center, change advanced sharing settings, all networks, turn off password sharing protection

4, how to do remote?

Click win+r-> input mstsc-> OK, enter the IP address, user name, password.

Note: Sometimes OK, but the connection fails, to see whether remote connections are allowed in remote settings

Click Computer properties, remote settings, remote, select Allow connections

5, how to complete the Access database connection, save?

Connection statements for two types of access:

1. Local connection: <add name= "sql" connectionstring= "Provider=microsoft.ace.oledb.12.0;data source=" C:\Users\bncPc\db\ Legal.accdb ' "/>

2. Remote connection: <add name= "sql" connectionstring= "Provider=microsoft.ace.oledb.12.0;data source=//10.130.16.137/db/ Legal.accdb "/>

6. How to save IP address?

By controlling the operation of the config file, the method is as follows:

        Private voidSave () {Try            {                if(TextBox3.Text! ="") {XDocument doc=xdocument.load (file); //SQL database Database configuration//string connstring = "Initial catalog=highway;data source=" + This.textBox3.Text + "; uid=" + This.textBox4.Text + ";p W                   D= "+ This.textBox5.Text +"; "; //Access database remote configuration//Provider=microsoft.ace.oledb.12.0;data source=//10.130.16.136/db/legal.accdb                    stringConnString =@"Provider=microsoft.ace.oledb.12.0;data source=//"+ textBox3.Text.ToString () +"/db/legal.accdb"; Doc. Elements ("Configuration"). Elements ("connectionStrings"). Elements ("Add"). Attributes ("connectionString"). FirstOrDefault ().                    SetValue (connstring); Doc.                    Save (file); //Bug raised because connectionstring (public static variable) in Dbhelpersql was not modifiedXDocument Xdoc =xdocument.load (file); stringval = doc. Elements ("Configuration"). Elements ("connectionStrings"). Elements ("Add"). Attributes ("connectionString"). FirstOrDefault ().                    Value; Sqlhelper.connstr=Val; }                Else                {                    return; }            }            Catch(Exception ex) {MessageBox.Show (ex). Message+Ex.                StackTrace); //MessageBox.Show ("Database save failed!! ");            }        }
View Code

Accessories: Configuration Documents

"Introduction to use"

A system using vs2010+access completed, the operation requirements are as follows:

1 win7 or above operating system

2 Installing Office 2010 or later

3 Installing the FromWork4.0 plug-in and AccessDatabaseEngine.exe

Two administrator operation configuration

1, copy the "DB folder" in the "Legal consulting system" folder to drive C

2. Set the DB folder to share

(1) Right-click Folder-"Share-" specific users-"Add the Everyone user, and set read and write." -"Shared

(2) Open Control Panel-"Network and internet-" Network and Sharing center-"Change advanced sharing settings-" All networks-"Turn off password sharing protection

3, install Microsoft.NET.exe under DB

4, Installation: Legal Counseling Center \debug\setup1.msi Uninstall: Legal Counseling Center \debug\setup.exe

Use of three clients

1, copy the "Client folder" in the "Legal consulting system" folder to drive C

2, install the Microsoft.NET.exe and AccessDatabaseEngine.exe under the client

3,win+r Open cmd-"mstsc-" Remote IP address

4. Open Software server settings under Change Administrator IP address login

Four initialization settings

1, administrator initialization: User name: admin Password: admin

2, User initialization: User name: ad password: 123

Five common logon Failure answers

1 Db/client folder is copied to C drive

2 The remote server is successful

3 The IP address under Server settings is configured correctly.

"End of article" chapter Summary

At this point, the Access Remote Connection database and form Packaging Deployment Series are all over, and this series focuses on some of the access remote connection operations, as well as the understanding of Ftp,vpn, file sharing, and so on during this exploration. The middle of the introduction of Excel and the chart, and recommend a few related files. The segmentation method is used to analyze the whole. First introduce the idea and the overall effect. Then the knowledge point combing summary, the final summary. This creates a separation of knowledge, which then needs to be used directly and to help those who need it.

Source: Access remote access XXXX system. Zip

"Project summary based on winform+access LAN shared database" Article III: Access remote connection database and form package deployment

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.