• 大小: 61KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: 其他
  • 标签: 赛马程序  c#  

资源简介

马赛共有20轮,本软件将供投注公众作出自己对胜者的选择,数据库将接受数据,并对 客户的操作做出日志记录,服务器可以将投注者的选择以一定格式导出到指定文件中, 还必须提供按胜场次数排序输出最终结果的功能。客户可以在请求服务器信息,如果服 务器顺利接受到请求,将会返回版本信息和作者信息

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
using System.Collections;

namespace 赛马程序
{
    public partial class Form1 : Form
    {
        SqlConnection conn;
        SqlDataAdapter da;
        DataSet ds;
        int count = 0;
        public static string filepath = Directory.GetParent(Directory.GetCurrentDirectory()).ToString();
        StreamWriter logwriter;
        FileStream writer_fs;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {
            conn = new SqlConnection(“data source=.;initial catalog=masterr;integrated security=sspi“);
            ds = new DataSet();
            da = new SqlDataAdapter(“select * from horseprediction“ conn);
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 10;
            progressBar1.Step = 3;
        }

        private void button3_Click(object sender EventArgs e)
        {
            conn.Open();
            ds.Clear();
            da.Fill(ds “horseprediction“);
            dataGridView1.DataSource = ds.Tables[0];
            conn.Close();

        }
        private void button4_Click(object sender EventArgs e)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand(“update horseprediction set winner=@winner where round=@round“ conn);
            cmd.Parameters.Add(“@winner“ SqlDbType.Char 20 “winner“);
            cmd.Parameters.Add(“@round“ SqlDbType.Int 4 “round“);
            da.UpdateCommand = cmd;
            if (ds.HasChanges(DataRowState.Modified))
            {
                count = ds.GetChanges(DataRowState.Modified).Tables[0].Rows.Count;
            }
            da.Update(ds “horseprediction“);
            MessageBox.Show(“数据更新成功!“ “消息提示“ MessageBoxButtons.OK MessageBoxIcon.Information);
            conn.Close();
        }

        private void button5_Click(object sender EventArgs e)
        {

            conn.Open();
            SqlCommand cmd_winner = new SqlCommand(“select winner from horseprediction“ conn);
            SqlDataReader dr = cmd_winner.ExecuteReader();
            StreamWriter writer = new StreamWriter(filepath + “\\horse.txt“);
            while (dr.Read())
            {
                string winner = dr.GetString(0);
                writer.WriteLine(winner);
            }
            writer.Close();
            conn.Close();
            MessageBox.Show(“数据导出成功!“ “消息提示“ MessageBoxButtons.OK MessageBoxIcon.Information);
        }

        private void button1_Click(object sender EventArgs e)
        {
            timer1.Enabled = true;
            button1.Enabled = false;
            button2.Enabled = true;
            writer_fs = new FileStream(filepath + 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-12-11 13:45  Backup3\
     目录           0  2012-12-14 08:25  Backup3\bin\
     目录           0  2012-12-11 13:43  Backup3\bin\Debug\
     文件       14848  2012-12-11 13:47  Backup3\bin\Debug\赛马程序.exe
     文件       32256  2012-12-11 13:47  Backup3\bin\Debug\赛马程序.pdb
     文件       11608  2012-12-14 08:34  Backup3\bin\Debug\赛马程序.vshost.exe
     文件         490  2010-03-17 22:39  Backup3\bin\Debug\赛马程序.vshost.exe.manifest
     文件         228  2012-12-14 08:34  Backup3\bin\horse.txt
     文件         577  2012-12-14 08:24  Backup3\bin\log.txt
     目录           0  2012-12-04 14:34  Backup3\bin\Release\
     文件         115  2012-12-14 08:25  Backup3\bin\statistic_horse.txt
     文件        6714  2012-12-14 08:50  Backup3\Form1.cs
     文件        7709  2012-12-07 09:39  Backup3\Form1.Designer.cs
     文件        6008  2012-12-07 09:39  Backup3\Form1.resx
     目录           0  2012-12-11 13:43  Backup3\obj\
     目录           0  2012-12-11 13:47  Backup3\obj\Debug\
     文件        5251  2012-12-11 13:47  Backup3\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         306  2012-12-11 13:47  Backup3\obj\Debug\GenerateResource-ResGen.read.1.tlog
     文件         366  2012-12-11 13:47  Backup3\obj\Debug\GenerateResource-ResGen.write.1.tlog
     目录           0  2012-12-11 13:43  Backup3\obj\Debug\TempPE\
     文件        4608  2012-12-04 14:34  Backup3\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
     文件        1195  2012-12-14 08:34  Backup3\obj\Debug\赛马程序.csproj.FileListAbsolute.txt
     文件       14848  2012-12-11 13:47  Backup3\obj\Debug\赛马程序.exe
     文件         180  2012-12-11 13:47  Backup3\obj\Debug\赛马程序.Form1.resources
     文件       32256  2012-12-11 13:47  Backup3\obj\Debug\赛马程序.pdb
     文件         180  2012-12-11 13:47  Backup3\obj\Debug\赛马程序.Properties.Resources.resources
     文件         471  2009-04-27 18:34  Backup3\Program.cs
     目录           0  2012-12-11 13:43  Backup3\Properties\
     文件        1196  2009-04-27 18:34  Backup3\Properties\AssemblyInfo.cs
     文件        2862  2012-12-04 14:34  Backup3\Properties\Resources.Designer.cs
     文件        5612  2009-04-27 18:34  Backup3\Properties\Resources.resx
............此处省略11个文件信息

评论

共有 条评论