. NET underlying database transfer program
Divided into server side and client
This program has the following functions:
1. There is considerable security implicit in the resolution of direct-attached databases.
2. When large wide area network is used, Big data query is equivalent to the speed of transmission, which solves the problem of large data transmission. Large data volume compression can increase the speed 7~40 times.
3. Because the framework uses TCP as the underlying connection, instant messages can be sent. Upload files in real time. Can act as, the program submits a form, always reminds the function.
4. Compatible with three-layer frame. The three-layer framework program can be used directly without the need for changes.
Server-side:
Server side is relatively simple, a few lines of code can be done
1. Add Reference datautils.v1.1
2. Set the database to which the server is connected (this operation is on the server side)
Code:
This.listener.DbHelper.ConnectionString = Constr;//constr is a connection string
3. Turn on monitoring
Public SocketListener listener = new SocketListener ();
Listener. Startlistening ();
4. Registering events
Listener. Regeditsession + = new Feng.Net.Tcp.SocketListener.RegeditSessionEventHandler (listener_regeditsession);
<pre name= "code" class= "CSharp" > void Listener_regeditsession (object sender, Regeditsessioneventargs e) { try { E.password = = "<span style=" font-family:arial, Helvetica, Sans-serif; " >pwd</span> "//Here is the client login box, fill in the Login box password
E.user = = "<span style=" font-family:arial, Helvetica, Sans-serif; " >admin</span> " <span style=" font-family:arial, Helvetica, Sans-serif; " >//here for the Customer login box, fill in the login name </span> //Here can determine whether to allow this user to login e.session = new Random (). Next (3, Int. MAXVALUE-10);//Set the user's session here again to ensure security. E.cancel = false;
If E.cancel is set to True, the user registration is canceled, and the user's connection is closed. } catch (Exception ex) { Feng.Utils.ExceptionHelper.ShowError (ex); } }
Client
1. Add Reference datautils.v1.1
2. Create an Object
<pre name= "code" class= "CSharp" >sqlclient <span style= "font-family:arial, Helvetica, Sans-serif;" >client = new SqlClient ("IP Address");//client. Host = "Xxxxxxxx.eicp.net"; can use IP address or peanut shell dynamic Domain name,</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" >feng.data.mssql.msdbhelpersql.client = client;</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" > Setting up Connections for clients </span>
<span style= "font-family:arial, Helvetica, Sans-serif;" > Moving Soft code generator dbhelper using </span><span style= "font-family:arial, Helvetica, Sans-serif;" >Feng.Data.MsSQL.MsDbHelperSQL</span>
<span style= "font-family:arial, Helvetica, Sans-serif;" ></span><pre name= "code" class= "CSharp" >///<summary>// whether the record exists/// </ summary> Public bool Exists (string title_id, string title) { StringBuilder strSQL = new StringBuilder (); strsql.append ("SELECT count (1) from titles"); Strsql.append ("Where [email protected]_id and [email protected]"); sqlparameter[] Parameters = {New SqlParameter ("@title_id", SqlDbType.VarChar, 6), New SqlParameter ("@title", sqldbtype.varchar,80)}; Parameters[0]. Value = title_id; PARAMETERS[1]. Value = title; Return Msdbhelpersql.exists (Strsql.tostring (), parameters); }
Client-side functions include many operations that can perform all
FENG.NET.TCP.SQLCLIENT.EXECUTESQL (String)
FENG.NET.TCP.SQLCLIENT.EXECUTESQL (string, params system.data.sqlclient.sqlparameter[])
FENG.NET.TCP.SQLCLIENT.EXECUTESQL (string, int)
FENG.NET.TCP.SQLCLIENT.EXECUTESQL (string, int, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.ExecuteSqlTran (system.collections.generic.list<string>)
Feng.Net.Tcp.SqlClient.ExecuteSqlTran (system.collections.generic.list<feng.data.modleinfo>)
Feng.Net.Tcp.SqlClient.ExecuteSqlTran (SYSTEM.COLLECTIONS.GENERIC.LIST<STRING>, int)
Feng.Net.Tcp.SqlClient.ExecuteSqlTran (SYSTEM.COLLECTIONS.GENERIC.LIST<FENG.DATA.MODLEINFO>, int)
Feng.Net.Tcp.SqlClient.Exists (String)
Feng.Net.Tcp.SqlClient.Exists (string, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.Exists (string, int)
Feng.Net.Tcp.SqlClient.Exists (string, int, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.GetMaxID (String, String)
Feng.Net.Tcp.SqlClient.GetMaxID (String, string, int)
Feng.Net.Tcp.SqlClient.GetSingle (String)
Feng.Net.Tcp.SqlClient.GetSingle (string, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.GetSingle (string, int)
Feng.Net.Tcp.SqlClient.GetSingle (string, int, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.PostCallBac (System.IAsyncResult)
Feng.Net.Tcp.SqlClient.Query (String)
Feng.Net.Tcp.SqlClient.Query (string, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.Query (string, int)
Feng.Net.Tcp.SqlClient.Query (string, int, params system.data.sqlclient.sqlparameter[])
Feng.Net.Tcp.SqlClient.QueryTable (String)
C # CS-mode operation database connects directly to database using SQL connection string