• 大小: 65.73MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-06-21
  • 语言: C#
  • 标签: 抽奖  

资源简介

C#写的年会抽奖软件包含源代码

资源截图

代码片段和文件信息



using System;
using System.Data;
using System.Configuration;
using System.Data.OleDb;
using System.Text;
using System.Windows.Forms;

/// 
/// DataAccess 为数据库操作等全局定义的一些类
/// 

public class DataAccess
{
    public DataAccess()
    {
    }
    public static bool DataIsChange;

    #region 配置数据库连接字符串
    /// 
    /// 获取C/S系统根目录
    /// 

    public static string SysRootPath()
    {
        string resultPath = string.Empty;

        string sysPath = Application.StartupPath;
        if (sysPath.LastIndexOf(“bin“) > 0)
        {
            resultPath = sysPath.Substring(0 sysPath.LastIndexOf(“bin“));
        }
        else
        {
            resultPath = sysPath;
        }

        return resultPath;
    }



    /// 
    /// 配置数据库连接字符串
    /// 

    private static string ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=“ + System.Environment.CurrentDirectory + “\\data\\LD.mdb;Persist Security Info=False;Jet OLEDB:Database Password=shiyanexperiment;“;
    #endregion

    #region  执行SQL语句,返回Bool值
    /// 
    /// 执行SQL语句,返回Bool值
    /// 

    /// 要执行的SQL语句
    /// 返回BOOL值,True为执行成功
    public bool ExecuteSQL(string sql)
    {
        OleDbConnection con = new OleDbConnection(ConnectionString);
        OleDbCommand cmd = new OleDbCommand(sql con);
        try
        {
            con.Open();
            cmd.ExecuteNonQuery();
            return true;
        }
        catch
        {
            return false;
        }
        finally
        {
            con.Close();
            con.Dispose();
            cmd.Dispose();
        }
    }
    #endregion


    #region 读取带参数的结果集
    /// 
    /// 读取带参数的结果集
    /// 

    /// SQL语句
    /// 参数列表
    /// 结果集
    public OleDbDataReader ExecuteReader(string sql)
    {
        OleDbDataReader reader = null;
        OleDbConnection con = new OleDbConnection(ConnectionString);
        OleDbCommand cmd = new OleDbCommand(sql con);
        try
        {
            con.Open();
            reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        }
        catch
        {
        }
        
        return reader;
    }
    #endregion

    #region  执行SQL语句,返回DataTable
    /// 
    /// 执行SQL语句,返回DataTable
    /// 

    /// 要执行的SQL语句
    /// 返回DataTable类型的执行结果
    public DataTable GetDataTable(string sql)
    {
        DataSet ds = new DataSet();
        OleDbConnection con = new OleDbConnection(ConnectionString);
        OleDbDataAdapter da = new OleDbDataAdapter(sql con);
        try
        {
            da.Fill(ds “tb“);
        }
        catch (Exception ex)
        {
            throw new Ex

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-07 17:44  C#年会抽奖软件\
     目录           0  2019-01-07 17:43  C#年会抽奖软件\Lucky Draw\
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\
     文件         920  2013-12-30 20:42  C#年会抽奖软件\Lucky Draw\Lucky Draw.sln
     文件       52224  2017-12-20 14:28  C#年会抽奖软件\Lucky Draw\Lucky Draw.suo
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\data\
     文件      530028  2014-01-01 15:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\data\choujiang.wav
     文件     1764112  2014-01-01 21:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\data\gongxi.wav
     文件     1764112  2014-01-01 21:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\data\join.wav
     文件     1249280  2014-01-11 08:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\data\LD.mdb
     文件    28887664  2013-12-31 17:33  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\data\喜洋洋.wav
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\抽奖系统_1_0_0_4\
     文件       25214  2009-11-01 03:49  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\抽奖系统_1_0_0_4\logo.ico.deploy
     文件      808448  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\抽奖系统_1_0_0_4\抽奖系统.exe.deploy
     文件        7134  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\抽奖系统_1_0_0_4\抽奖系统.exe.manifest
     目录           0  2019-01-07 17:44  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\神仙抽奖系统_1_0_0_1\
     文件       25214  2009-11-01 03:49  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\神仙抽奖系统_1_0_0_1\logo.ico.deploy
     文件      806912  2012-10-23 16:31  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\神仙抽奖系统_1_0_0_1\神仙抽奖系统.exe.deploy
     文件        7170  2012-10-23 16:31  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\Application Files\神仙抽奖系统_1_0_0_1\神仙抽奖系统.exe.manifest
     文件      475576  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\setup.exe
     文件        5320  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\抽奖系统.application
     文件        5356  2012-10-23 16:31  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\app.publish\神仙抽奖系统.application
     文件       25588  2012-10-24 16:00  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\pm3.wav
     文件        1587  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\抽奖系统.application
     文件      808448  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\抽奖系统.exe
     文件        3476  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\抽奖系统.exe.manifest
     文件       75264  2012-10-25 08:14  C#年会抽奖软件\Lucky Draw\Lucky Draw\bin\Debug\抽奖系统.pdb
............此处省略103个文件信息

评论

共有 条评论