• 大小: 919KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: C#  winform  增删改查  

资源简介

基本的功能:动态菜单,增删改查,窗体间带参数跳转,列表页面跳到update页面,列表跳到add页面,完成add,从新绑定列表页面。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Mycems.Model;
using DAL;

namespace Mycems.DAL
{
    public class AdapterService
    {
        public AdapterService()
        {
        }
#region  成员方法
/// 
/// 是否存在该记录
/// 

        public bool Exists(string AdapterNo)
{
SqlParameter[] parameters = {
new SqlParameter(“@AdapterNo“ SqlDbType.Char22)};
            parameters[0].Value = AdapterNo;

            return new DbaseHelper().Exists(“CheckAdapterNo“ parameters);
}

/// 
///  增加一条数据
/// 

public bool Add(Adapter model)
{
            SqlParameter[] parameters = {
new SqlParameter(“@AdapterNo“ SqlDbType.Char22)
new SqlParameter(“@AdapterName“ SqlDbType.NVarChar50)
new SqlParameter(“@AdapterAlias“ SqlDbType.NChar16)
new SqlParameter(“@AdapterType“ SqlDbType.Char20)
new SqlParameter(“@DeviceNo“ SqlDbType.Char20)
new SqlParameter(“@IP“ SqlDbType.Char20)
new SqlParameter(“@Port“ SqlDbType.Int4)};
            parameters[0].Value = model.AdapterNo;
            parameters[1].Value = model.AdapterName;
            parameters[2].Value = model.AdapterAlias;
            parameters[3].Value = model.AdapterType;
            parameters[4].Value = model.DeviceNo;
            parameters[5].Value = model.IP;
            parameters[6].Value = model.Port;
            if(new DbaseHelper().ExecuteNonQuery(“AddAdapter“ parameters) > 0)
                return true;
            else
                return false;
}

/// 
///  更新一条数据
/// 

        public bool Update(Adapter model)
{
            SqlParameter[] parameters = {
new SqlParameter(“@AdapterNo“ SqlDbType.Char22)
new SqlParameter(“@AdapterName“ SqlDbType.NVarChar50)
new SqlParameter(“@AdapterAlias“ SqlDbType.NChar16)
new SqlParameter(“@AdapterType“ SqlDbType.Char20)
new SqlParameter(“@DeviceNo“ SqlDbType.Char20)
new SqlParameter(“@IP“ SqlDbType.Char20)
new SqlParameter(“@Port“ SqlDbType.Int4)};
            parameters[0].Value = model.AdapterNo;
            parameters[1].Value = model.AdapterName;
            parameters[2].Value = model.AdapterAlias;
            parameters[3].Value = model.AdapterType;
            parameters[4].Value = model.DeviceNo;
            parameters[5].Value = model.IP;
            parameters[6].Value = model.Port;
            if(new DbaseHelper().ExecuteNonQuery(“UpdateAdapter“ parameters) > 0)
                return true;
            else
                return false;
}

/// 
/// 删除一条数据
/// 

        public bool Delete(string AdapterNo)
{
SqlParameter[] parameters = {
new SqlParameter(“@AdapterNos“ SqlDbType.NVarChar150)};
            parameters[0].Value = AdapterNo;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3562  2013-01-13 15:28  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunctionPro.sln

    ..A..H.     75776  2013-04-04 16:09  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunctionPro.suo

     文件    3145728  2013-04-04 16:07  Winform程序例子-1-13\WindowsFormsFunctionPro\数据库\CemsMenuTest.mdf

     文件    1048576  2013-04-04 16:07  Winform程序例子-1-13\WindowsFormsFunctionPro\数据库\CemsMenuTest_log.ldf

     文件        372  2013-01-13 16:42  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Child1.cs

     文件       2954  2013-01-13 16:42  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Child1.Designer.cs

     文件       5817  2013-01-13 16:42  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Child1.resx

     文件        370  2013-01-13 15:35  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Form1.cs

     文件       1417  2013-01-13 15:35  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Form1.Designer.cs

     文件       5817  2013-01-13 15:35  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Form1.resx

     文件        628  2013-01-13 16:43  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\LOGIN.cs

     文件       7858  2013-01-13 16:43  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\LOGIN.Designer.cs

     文件       5817  2013-01-13 16:43  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\LOGIN.resx

     文件      10137  2013-01-13 16:41  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\MDIMenus.cs

     文件       3124  2013-01-13 16:19  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\MDIMenus.Designer.cs

     文件       6385  2013-01-13 16:19  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\MDIMenus.resx

     文件        653  2013-04-04 15:52  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Program.cs

     文件       9134  2013-03-16 20:28  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\WindowsFormsFunction.csproj

     文件        552  2013-01-15 19:25  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\WindowsFormsFunction.csproj.user

     文件       1396  2013-01-13 13:32  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\AssemblyInfo.cs

     文件       2890  2013-01-13 13:32  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Resources.Designer.cs

     文件       5612  2013-01-13 13:32  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Resources.resx

     文件       1105  2013-01-13 13:32  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Settings.Designer.cs

     文件        249  2013-01-13 13:32  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\Properties\Settings.settings

     文件       4440  2013-01-13 14:36  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6568  2013-04-04 16:06  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件      13711  2013-04-04 16:06  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\ResolveAssemblyReference.cache

     文件        180  2013-04-04 16:06  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\WindowsFormsFunction.Child1.resources

     文件        180  2013-04-04 16:06  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\WindowsFormsFunction.Form1.resources

     文件        180  2013-04-04 16:06  Winform程序例子-1-13\WindowsFormsFunctionPro\WindowsFormsFunction\obj\x86\Debug\WindowsFormsFunction.LOGIN.resources

............此处省略106个文件信息

评论

共有 条评论