瀏覽代碼

update 领取的sql用法,其他可能有问题还需要继续改

shenjian Office PC 7 年之前
父節點
當前提交
516396fb58
共有 4 個文件被更改,包括 27 次插入15 次删除
  1. 10 5
      source/BooksManageSystem.csproj
  2. 13 9
      source/DBcon.cs
  3. 1 1
      source/Properties/Resources.Designer.cs
  4. 3 0
      source/app.config

+ 10 - 5
source/BooksManageSystem.csproj

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -9,8 +9,11 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>BooksManageSystem</RootNamespace>
     <AssemblyName>BooksManageSystem</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
     <PublishUrl>发布\</PublishUrl>
     <Install>true</Install>
     <InstallFrom>Disk</InstallFrom>
@@ -23,11 +26,8 @@
     <MapFileExtensions>true</MapFileExtensions>
     <ApplicationRevision>0</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
-    <IsWebBootstrapper>false</IsWebBootstrapper>
     <UseApplicationTrust>false</UseApplicationTrust>
     <BootstrapperEnabled>true</BootstrapperEnabled>
-    <TargetFrameworkProfile>
-    </TargetFrameworkProfile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -38,6 +38,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>x86</PlatformTarget>
@@ -47,6 +48,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup>
     <ApplicationIcon>bookcase.ico</ApplicationIcon>
@@ -206,6 +208,9 @@
   <ItemGroup>
     <Content Include="bookcase.ico" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 13 - 9
source/DBcon.cs

@@ -147,10 +147,21 @@ namespace BooksManageSystem
                 DBHelper.ExecuteNonQuery(comm);
             }
 
-            using (OleDbCommand comm = new OleDbCommand(@"insert into operate (op_book_no,op,op_date,op_count,operator,after_op_count) values 
-(" + id + "," + ((int)EnumOP.领).ToString() + ",'" + time.ToString() + "'," + count.ToString() + ",'" + opertor + "'," + (c - count) + ")"))
+            using (OleDbCommand comm = new OleDbCommand(@"insert into operate (op_book_no,op,op_date,op_count,operator,after_op_count) values (@id,@op,@op_date,@op_count,@opertor,@after_op_count)"))
             {
+                comm.Parameters.AddWithValue("@id", (uint)id);
+                comm.Parameters.AddWithValue("@op", (int)EnumOP.领);
+                comm.Parameters.AddWithValue("@op_date", time.ToString());
+                comm.Parameters.AddWithValue("@op_count", count);
+                comm.Parameters.AddWithValue("@opertor", opertor);
+                comm.Parameters.AddWithValue("@after_op_count", c - count);
+
+
+                //insert into operate (op_book_no,op,op_date,op_count,operator,after_op_count) values (?,?,?,?,?,?)
+                //insert into operate (op_book_no,op,op_date,op_count,operator,after_op_count) values (1,2,'2018/2/6 10:48:09',1,'afsdf',1)
                 //INSERT INTO table_name (列1, 列2,...) VALUES (值1, 值2,....)
+
+
                 DBHelper.ExecuteNonQuery(comm);
                 return c - count;
             }
@@ -194,13 +205,6 @@ namespace BooksManageSystem
             }
 
 
-
-
-
-
-
-
-
         }
         /// <summary>
         /// 返回BID

+ 1 - 1
source/Properties/Resources.Designer.cs

@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     此代码由工具生成。
-//     运行时版本:4.0.30319.34014
+//     运行时版本:4.0.30319.42000
 //
 //     对此文件的更改可能会导致不正确的行为,并且如果
 //     重新生成代码,这些更改将会丢失。

+ 3 - 0
source/app.config

@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration>