瀏覽代碼

update db

张泳健 8 年之前
父節點
當前提交
6e8c0d668e

+ 32 - 1
.gitignore 查看文件

@@ -1,2 +1,33 @@
1
-GWSocketClient/obj/
1
+
2
+
2 3
 GWSocketClient/bin/
4
+GWSocketClient/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
5
+GWSocketClient/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
6
+GWSocketClient/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
7
+GWSocketClient/obj/Release/GWSocketClient.pdb
8
+GWSocketClient/obj/Release/GWSocketClient.exe
9
+GWSocketClient/obj/Release/GWSocketClient.csprojResolveAssemblyReference.cache
10
+GWSocketClient/obj/Release/GWSocketClient.csproj.GenerateResource.Cache
11
+GWSocketClient/obj/Release/GWSocketClient.csproj.FileListAbsolute.txt
12
+GWSocketClient/obj/Release/GWSocketClient.WebViewForm.resources
13
+GWSocketClient/obj/Release/GWSocketClient.Properties.Resources.resources
14
+GWSocketClient/obj/Release/GWSocketClient.Form1.resources
15
+GWSocketClient/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
16
+GWSocketClient/obj/Release/DesignTimeResolveAssemblyReferences.cache
17
+GWSocketClient/obj/Release/CoreCompileInputs.cache
18
+GWSocketClient/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
19
+GWSocketClient/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
20
+GWSocketClient/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
21
+GWSocketClient/obj/Debug/GWSocketClient.pdb
22
+GWSocketClient/obj/Debug/GWSocketClient.exe
23
+GWSocketClient/obj/Debug/GWSocketClient.csprojResolveAssemblyReference.cache
24
+GWSocketClient/obj/Debug/GWSocketClient.csproj.GenerateResource.Cache
25
+GWSocketClient/obj/Debug/GWSocketClient.csproj.FileListAbsolute.txt
26
+GWSocketClient/obj/Debug/GWSocketClient.WebViewForm.resources
27
+GWSocketClient/obj/Debug/GWSocketClient.Properties.Resources.resources
28
+GWSocketClient/obj/Debug/GWSocketClient.MyMessageBox.resources
29
+GWSocketClient/obj/Debug/GWSocketClient.InfoEditor.resources
30
+GWSocketClient/obj/Debug/GWSocketClient.Form1.resources
31
+GWSocketClient/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
32
+GWSocketClient/obj/Debug/DesignTimeResolveAssemblyReferences.cache
33
+GWSocketClient/obj/Debug/CoreCompileInputs.cache

+ 4 - 0
GWSocketClient/Form1.cs 查看文件

@@ -363,6 +363,10 @@ namespace GWSocketClient
363 363
 
364 364
         private void button1_Click(object sender, EventArgs e)
365 365
         {
366
+            InfoEditor ie = new InfoEditor();
367
+            ie.Show();
368
+
369
+
366 370
 //            var persons = JsonConvert.DeserializeObject<List<WvBean>>(json);
367 371
 //            var ja = JArray.Parse(jsonString);
368 372
 

+ 10 - 0
GWSocketClient/GWSocketClient.csproj 查看文件

@@ -58,12 +58,19 @@
58 58
     </Reference>
59 59
   </ItemGroup>
60 60
   <ItemGroup>
61
+    <Compile Include="db\AccsessDbLoader.cs" />
61 62
     <Compile Include="Form1.cs">
62 63
       <SubType>Form</SubType>
63 64
     </Compile>
64 65
     <Compile Include="Form1.Designer.cs">
65 66
       <DependentUpon>Form1.cs</DependentUpon>
66 67
     </Compile>
68
+    <Compile Include="InfoEditor.cs">
69
+      <SubType>Form</SubType>
70
+    </Compile>
71
+    <Compile Include="InfoEditor.Designer.cs">
72
+      <DependentUpon>InfoEditor.cs</DependentUpon>
73
+    </Compile>
67 74
     <Compile Include="model\WvBean.cs" />
68 75
     <Compile Include="MyMessageBox.cs">
69 76
       <SubType>Form</SubType>
@@ -95,6 +102,9 @@
95 102
     <EmbeddedResource Include="Form1.resx">
96 103
       <DependentUpon>Form1.cs</DependentUpon>
97 104
     </EmbeddedResource>
105
+    <EmbeddedResource Include="InfoEditor.resx">
106
+      <DependentUpon>InfoEditor.cs</DependentUpon>
107
+    </EmbeddedResource>
98 108
     <EmbeddedResource Include="MyMessageBox.resx">
99 109
       <DependentUpon>MyMessageBox.cs</DependentUpon>
100 110
     </EmbeddedResource>

+ 66 - 0
GWSocketClient/InfoEditor.Designer.cs 查看文件

@@ -0,0 +1,66 @@
1
+namespace GWSocketClient
2
+{
3
+    partial class InfoEditor
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.dataGridView1 = new System.Windows.Forms.DataGridView();
32
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
33
+            this.SuspendLayout();
34
+            // 
35
+            // dataGridView1
36
+            // 
37
+            this.dataGridView1.AllowUserToOrderColumns = true;
38
+            this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
39
+            | System.Windows.Forms.AnchorStyles.Left) 
40
+            | System.Windows.Forms.AnchorStyles.Right)));
41
+            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
42
+            this.dataGridView1.Location = new System.Drawing.Point(12, 190);
43
+            this.dataGridView1.Name = "dataGridView1";
44
+            this.dataGridView1.RowTemplate.Height = 23;
45
+            this.dataGridView1.Size = new System.Drawing.Size(984, 400);
46
+            this.dataGridView1.TabIndex = 0;
47
+            // 
48
+            // InfoEditor
49
+            // 
50
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
51
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
52
+            this.ClientSize = new System.Drawing.Size(1008, 602);
53
+            this.Controls.Add(this.dataGridView1);
54
+            this.Name = "InfoEditor";
55
+            this.Text = "InfoEditor";
56
+            this.Load += new System.EventHandler(this.InfoEditor_Load);
57
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
58
+            this.ResumeLayout(false);
59
+
60
+        }
61
+
62
+        #endregion
63
+
64
+        private System.Windows.Forms.DataGridView dataGridView1;
65
+    }
66
+}

+ 27 - 0
GWSocketClient/InfoEditor.cs 查看文件

@@ -0,0 +1,27 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+using GWSocketClient.db;
11
+
12
+namespace GWSocketClient
13
+{
14
+    public partial class InfoEditor : Form
15
+    {
16
+        public InfoEditor()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void InfoEditor_Load(object sender, EventArgs e)
22
+        {
23
+            MessageBox.Show(AccsessDbLoader.getInstance().getWebViewJson());
24
+            dataGridView1.DataSource = AccsessDbLoader.getInstance().getDt();
25
+        }
26
+    }
27
+}

+ 120 - 0
GWSocketClient/InfoEditor.resx 查看文件

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

二進制
GWSocketClient/bin/Debug/dbfile/ID_INFO.accdb 查看文件


+ 60 - 0
GWSocketClient/bin/Debug/html/index.html 查看文件

@@ -0,0 +1,60 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+
4
+<head>
5
+    <title></title>
6
+    <meta charset="UTF-8">
7
+    <meta name="viewport" content="width=device-width, initial-scale=1">
8
+    
9
+
10
+
11
+    <style>
12
+        * {
13
+            padding: 0;
14
+            margin: 0;
15
+            font-family: "微软雅黑","arial"
16
+        }
17
+        h1{
18
+        	text-align: center;
19
+        }
20
+        #content{
21
+        	background-color: #abc;
22
+        }
23
+        .item{
24
+        	padding:10px;
25
+        }
26
+        .input_style{
27
+        	width: 500px;
28
+        }
29
+    </style>
30
+
31
+</head>
32
+
33
+<body onload="bodyonload()">
34
+	<input type="hidden" id="all_data" value="">
35
+	<h1>内容显示</h1>
36
+	<div id="content">
37
+		<div class="item">
38
+			<label>ID码</label>:
39
+			<input type="text" class="input_style" id="input_1">
40
+			长度: <label id="cur_len">25.0</label><label>/25.0</label>
41
+			说明: <label>alkjflajlfjlasjlfkjl</label>
42
+		</div>
43
+	</div>
44
+    
45
+    <script type="text/javascript">
46
+		
47
+		function bodyonload() {
48
+			// body...
49
+			// 
50
+			var data = document.getElementById('all_data').value;
51
+			alert(data);
52
+		}
53
+
54
+
55
+
56
+    </script>
57
+
58
+</body>
59
+
60
+</html>

二進制
GWSocketClient/bin/Release/dbfile/ID_INFO.accdb 查看文件


+ 60 - 0
GWSocketClient/bin/Release/html/index.html 查看文件

@@ -0,0 +1,60 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+
4
+<head>
5
+    <title></title>
6
+    <meta charset="UTF-8">
7
+    <meta name="viewport" content="width=device-width, initial-scale=1">
8
+    
9
+
10
+
11
+    <style>
12
+        * {
13
+            padding: 0;
14
+            margin: 0;
15
+            font-family: "微软雅黑","arial"
16
+        }
17
+        h1{
18
+        	text-align: center;
19
+        }
20
+        #content{
21
+        	background-color: #abc;
22
+        }
23
+        .item{
24
+        	padding:10px;
25
+        }
26
+        .input_style{
27
+        	width: 500px;
28
+        }
29
+    </style>
30
+
31
+</head>
32
+
33
+<body onload="bodyonload()">
34
+	<input type="hidden" id="all_data" value="">
35
+	<h1>内容显示</h1>
36
+	<div id="content">
37
+		<div class="item">
38
+			<label>ID码</label>:
39
+			<input type="text" class="input_style" id="input_1">
40
+			长度: <label id="cur_len">25.0</label><label>/25.0</label>
41
+			说明: <label>alkjflajlfjlasjlfkjl</label>
42
+		</div>
43
+	</div>
44
+    
45
+    <script type="text/javascript">
46
+		
47
+		function bodyonload() {
48
+			// body...
49
+			// 
50
+			var data = document.getElementById('all_data').value;
51
+			alert(data);
52
+		}
53
+
54
+
55
+
56
+    </script>
57
+
58
+</body>
59
+
60
+</html>

+ 28 - 12
GWSocketClient/db/AccsessDbLoader.cs 查看文件

@@ -1,5 +1,6 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3
+using System.Data;
3 4
 using System.Data.OleDb;
4 5
 using System.Linq;
5 6
 using System.Text;
@@ -14,14 +15,21 @@ namespace GWSocketClient.db
14 15
     {
15 16
         private static AccsessDbLoader INSTANCE = null;
16 17
 
17
-        private static List<WvBean> wvBeans = new List<WvBean>();
18
-        public static Dictionary<string, string> ID_INFO = new Dictionary<string, string>();
18
+        private DataTable dt = new DataTable();
19
+
20
+        private List<WvBean> wvBeans = new List<WvBean>();
21
+        public Dictionary<string, string> ID_INFO = new Dictionary<string, string>();
19 22
 
20 23
         public static AccsessDbLoader getInstance(string dbssPath = "")
21 24
         {
22 25
             return INSTANCE ?? (INSTANCE = new AccsessDbLoader(dbssPath));
23 26
         }
24 27
 
28
+        public DataTable getDt()
29
+        {
30
+            return dt;
31
+        }
32
+
25 33
         public Dictionary<string, string> getUserIdInfo()
26 34
         {
27 35
             return ID_INFO;
@@ -47,16 +55,23 @@ namespace GWSocketClient.db
47 55
             OleDbConnection mycon = null;
48 56
             OleDbDataReader myReader = null;
49 57
 
58
+            OleDbCommand sqlcmd = null;
59
+
60
+            string strConnection = "Provider = Microsoft.ACE.OLEDB.12.0;" + "Data Source = " + dbPath;
61
+
50 62
             try
51 63
             {
52
-                string strConnection = "Provider = Microsoft.ACE.OLEDB.12.0;";
53
-                strConnection += "Data Source = " + dbPath;
54
-                using (OleDbConnection objConnection = new OleDbConnection(strConnection)
55
-                ) //用using替代objConnection.Close()  
64
+                using (OleDbConnection objConnection = new OleDbConnection(strConnection))
56 65
                 {
57
-                    objConnection.Open(); //打开连接   
58
-                    OleDbCommand sqlcmd = new OleDbCommand(@"select * from fw", objConnection); //sql语句     
59
-                    using (OleDbDataReader reader = sqlcmd.ExecuteReader()) //执行查询,用using替代reader.Close()  
66
+                    objConnection.Open();
67
+                    sqlcmd = new OleDbCommand(@"select * from fw", objConnection); //sql语句     
68
+
69
+
70
+                    OleDbDataAdapter da = new OleDbDataAdapter(sqlcmd);
71
+
72
+                    da.Fill(dt);
73
+
74
+                    using (OleDbDataReader reader = sqlcmd.ExecuteReader())
60 75
                     {
61 76
                         if (reader.Read()) //这个read调用很重要!不写的话运行时将提示找不到数据  
62 77
                         {
@@ -80,9 +95,9 @@ namespace GWSocketClient.db
80 95
                                 len = calcNull(reader.GetString(4));
81 96
                                 mode = calcNull(reader.GetString(5));
82 97
                                 desp = calcNull(reader.GetString(6));
83
-                                defalutValue = calcNull(reader.GetString(8));
84
-                                userValue = calcNull(reader.GetString(9));
85
-                                remark = calcNull(reader.GetString(7));
98
+                                defalutValue = calcNull(reader.GetString(7));
99
+                                userValue = calcNull(reader.GetString(8));
100
+                                remark = calcNull(reader.GetString(9));
86 101
                             }
87 102
                             catch (Exception exception)
88 103
                             {
@@ -115,6 +130,7 @@ namespace GWSocketClient.db
115 130
             {
116 131
                 MyMessageBox.ShowMessageBox(exception.Message);
117 132
             }
133
+
118 134
             return null;
119 135
         }
120 136