⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cooktb.cs

📁 一个较小的采购系统,一些比较实际的代码,可以用来参考
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// cooktb 的摘要说明
/// </summary>
public class cooktb
{
    public DataSet leibie()
    {
        //查找类别表中的类别
        connect conn = new connect();
        SqlCommand cmd = new SqlCommand("selectleibie",conn.conn());
        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter dapt = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        dapt.Fill(ds, "leibie");
        return ds;
    }
    public DataSet pinmin(string str)
    {
       //查找orderthing表中的物品品名,绑定dropdownlist
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        conn.Open();
        SqlCommand cmd = new SqlCommand("select order_PM from orderthing where order_Type='" + str + "'", conn);
        DataSet ds = new DataSet();
        SqlDataAdapter adpt = new SqlDataAdapter(cmd);
        adpt.Fill(ds, "orderthing");
        return ds;
    }
    public string GG(string str)
    {
        //通过品名查询出规格
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        conn.Open();
        SqlCommand cmd = new SqlCommand("select order_GG from orderthing where order_PM='"+str+"'",conn);
        string strGG = cmd.ExecuteScalar().ToString();
        return strGG;
        conn.Close();
        conn.Dispose();
    }
    public SqlDataReader search(string str,string type)
    {
        //模糊查询出品名
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        conn.Open();
        SqlCommand cmd = new SqlCommand("select order_PM from orderthing where order_Suoxie like '%" + str + "%' and order_Type='" + type + "'", conn);
        SqlDataReader dr = cmd.ExecuteReader();
        return dr;
        conn.Close();
        conn.Dispose();
    }
    public DataSet loaddata(string strPM)
    {//装载图片和规格
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        SqlCommand cmd = new SqlCommand("loadtp", conn);//存储过程用于载入数据
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter para = new SqlParameter("@pinmin", SqlDbType.NVarChar, 50);
        para.Value = strPM;
        cmd.Parameters.Add(para);
        DataSet ds = new DataSet();
        SqlDataAdapter dapt = new SqlDataAdapter(cmd);
        dapt.Fill(ds, "orderthing");
        return ds;
    }
    public DataSet load(string str)//载入数据
    {
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        SqlCommand cmd = new SqlCommand("loaddata", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter para = new SqlParameter("@session", SqlDbType.NVarChar, 50);
        para.Value = str;
        cmd.Parameters.Add(para);
        SqlDataAdapter dapt = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        dapt.Fill(ds, "cooktb");
        return ds;
    }
    public void update(string strsession)
    {
        DateTime time = DateTime.Now;
        string format = "MMddyyyyhhmmss";
        string str =time.ToString(format);
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        conn.Open();

        SqlCommand cmd = new SqlCommand("updatevalue",conn);//调用存调过程update来更新临时表中的value值 
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter para = new SqlParameter("@cooktb_value", SqlDbType.NVarChar, 50);
        para.Value = str;
        cmd.Parameters.Add(para);

        SqlParameter parasession = new SqlParameter("@cooktb_session", SqlDbType.NVarChar, 50);
        parasession.Value = strsession;
        cmd.Parameters.Add(parasession);

        SqlParameter paratime = new SqlParameter("@send_time", SqlDbType.DateTime);
        paratime.Value = time;
        cmd.Parameters.Add(paratime);

        cmd.ExecuteNonQuery();
        conn.Close();
        conn.Dispose();
     }
    public int check(string strsession)
    {
        SqlConnection conn = new SqlConnection();
        conn.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"];
        conn.Open();
        SqlCommand cmd = new SqlCommand("checkcooktb", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        SqlParameter para = new SqlParameter("@cooktb_session", SqlDbType.NVarChar, 50);
        para.Value = strsession;
        cmd.Parameters.Add(para);
        int count = Convert.ToInt16(cmd.ExecuteScalar());
        conn.Close();
        conn.Dispose();
         return count; 
  
    }
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -