五、庫存查詢功能的完善

一、數據庫的建立

由于查詢功能和之前的 入庫管理功能 所用的數據庫都一樣,這里仍使用yy_textile表
在fiber_yy數據庫下創建yy_textile表在這里插入圖片描述
在這里插入圖片描述
初始數據庫信息
在這里插入圖片描述

二、頁面的完善

登錄注冊頁面我就不演示了,前幾篇博文也都有介紹

query查詢頁面
在這里插入圖片描述
main_page頁面進行功能完善
在這里插入圖片描述

三、代碼實現

query查詢頁面

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;namespace fiber_yy
{public partial class query : Form{private DataSet dsall;public string constr = "server=CY-20190824RMES;Initial Catalog=fiber_yy;User ID=sa;pwd=beyond";private SqlDataAdapter mDataAdapter;public query(){InitializeComponent();comboBox1.Items.Add("根據面料名稱查詢");comboBox1.Items.Add("根據品號查詢");}private void button1_Click(object sender, EventArgs e){try{SqlConnection conn = new SqlConnection(constr);conn = new SqlConnection(constr);mDataAdapter = new SqlDataAdapter("SELECT name AS '紡織品名稱',number AS '紡織品品號',warp_density AS '經密度' ,weft_density AS '緯密度',warp_linear_density AS '經紗線密度',weft_linear_density AS '緯紗線密度',material AS '原料成分',square_meter_weight AS '平方米重量',width_of_cloth AS '幅寬',horse_length AS '匹長',organization AS '所用組織',stock AS '庫存量' FROM yy_textile", conn);dsall = new DataSet();mDataAdapter.Fill(dsall, "hard");dataGridView1.DataSource = dsall.Tables["hard"];}catch {MessageBox.Show("讀取失敗,請檢查是否存在該織物");}}private void button2_Click(object sender, EventArgs e){this.Hide();new main_page().Show();}private void button3_Click(object sender, EventArgs e){try{string model = comboBox1.SelectedItem.ToString();string command = textBox1.Text;byte[] MyData = new byte[0];SqlConnection conn = new SqlConnection(constr);conn.Open();SqlCommand cmd = new SqlCommand();cmd.Connection = conn;//cmd.CommandText = "select * from yy_textile where '" + model + "'='" + command + "'"; //sql語句按指定條件進行if (model == "根據面料名稱查詢"){cmd.CommandText = "select * from yy_textile where name='" + command + "'";model = "SELECT name AS '紡織品名稱',number AS '紡織品品號',warp_density AS '經密度' ,weft_density AS '緯密度',warp_linear_density AS '經紗線密度',weft_linear_density AS '緯紗線密度',material AS '原料成分',square_meter_weight AS '平方米重量',width_of_cloth AS '幅寬',horse_length AS '匹長',organization AS '所用組織',stock AS '庫存量' from yy_textile where name='" + command + "'";}if (model == "根據品號查詢"){cmd.CommandText = "select * from yy_textile where number='" + command + "'";model = "SELECT name AS '紡織品名稱',number AS '紡織品品號',warp_density AS '經密度' ,weft_density AS '緯密度',warp_linear_density AS '經紗線密度',weft_linear_density AS '緯紗線密度',material AS '原料成分',square_meter_weight AS '平方米重量',width_of_cloth AS '幅寬',horse_length AS '匹長',organization AS '所用組織',stock AS '庫存量' from yy_textile where number='" + command + "'";}SqlDataReader sdr = cmd.ExecuteReader();sdr.Read();object o = sdr["picture"];MyData = (byte[])sdr["picture"];//讀取第一個圖片的位流MemoryStream memoryStream = null;memoryStream = new MemoryStream(MyData);pictureBox1.Image = Image.FromStream(memoryStream);//將圖片賦給pictureBox1控件MessageBox.Show("讀取成功");conn = new SqlConnection(constr);mDataAdapter = new SqlDataAdapter(model, conn);dsall = new DataSet();mDataAdapter.Fill(dsall, "hard");dataGridView1.DataSource = dsall.Tables["hard"];}catch{MessageBox.Show("讀取失敗,請檢查是否存在該織物");}}}
}

main_page頁面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace fiber_yy
{public partial class main_page : Form{public main_page(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){MessageBox.Show("退出成功");this.Close();new Form1().Show();}private void button2_Click(object sender, EventArgs e){this.Close();new warehousing().Show();}private void button3_Click(object sender, EventArgs e){this.Close();new shipment().Show();}private void button4_Click(object sender, EventArgs e){this.Close();new query().Show();}}
}

四、效果演示

程序運行
在這里插入圖片描述
注冊我就不演示了,請參考前幾篇博文
yy_user表中找個賬號密碼,直接用戶登錄
在這里插入圖片描述
在這里插入圖片描述
登錄成功
在這里插入圖片描述
進入系統
在這里插入圖片描述

演示庫存查詢

在這里插入圖片描述
在這里插入圖片描述
查閱所含全部織物信息
在這里插入圖片描述
精確查找

根據面料名稱查詢
在這里插入圖片描述
在這里插入圖片描述

在這里插入圖片描述

根據品號查詢
在這里插入圖片描述
在這里插入圖片描述

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377694.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377694.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377694.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

整合ajaxmin 和 less 到VS.net

我用的前端框架是bootstrap_extra, twitter團隊做的,這個是他的一個擴展,首先從上面下載一個。至于ajaxmin,請參考這里1) 從bootstrap_extra的解壓包中,復制build目錄下三個文件到項目中去,這三個文件分別是BatchSubsi…

轉:只能選擇GridView中的一個CheckBox(單選CheckBox)

方法1: protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e){CheckBox cbx e.Row.FindControl("cbID") as CheckBox;try{//綁定選中CheckBox 客戶端IDcbx.Attributes.Add("onclick", "Change(" cbx.Cli…

六、出庫管理功能的實現

一、數據庫的建立 這里仍使用yy_textile表 在fiber_yy數據庫下創建yy_textile表 初始數據庫信息 二、頁面的完善 登錄注冊頁面我就不演示了,前幾篇博文也都有介紹 shipment出庫管理頁面 main_page頁面進行功能完善 三、代碼實現 shipment出庫管理頁面 u…

數學建模:層次分析法實例以及代碼

博主聯系方式: QQ:1540984562 QQ交流群:892023501 群里會有往屆的smarters和電賽選手,群里也會不時分享一些有用的資料,有問題可以在群里多問問。 目錄層次分析法的思想層次分析法步驟具體案例(市政工程項目建設決策)1.問題提出2.…

c 僵尸進程_演示僵尸進程的C程序

c 僵尸進程僵尸進程 (Zombie process) A process which has finished its execution but still has an entry in the process table to report to its parent process is known as a zombie process. 一個已經完成執行但仍在進程表中具有要報告給其父進程的條目的進程稱為僵尸進…

探秘IntelliJ IDEA 13測試版新功能——調試器顯示本地變量

IntelliJ IDEA在業界被公認為最好的Java開發平臺之一,JetBrains公司將在12月正式發布IntelliJ IDEA 13版本。 現在,小編將和大家一起探秘密IntelliJ IDEA 13測試版本新功能——調試器顯示本地變量。這個功能非常強大,調試器可以顯示變量&…

C# Windows Form下的控件的Validator(數據驗證)

由于偶爾的一個想法,謀生了一個做一個windows form下的Validator控件,或者直接說類吧! 因為webform下的Validator控件太好用了。哈哈,直接看代碼! 下面這個類,主要是一個簡單的驗證類,不過只是起…

七、流水查詢---記錄用戶登錄信息

一、數據庫的建立 在fiber_yy數據庫下創建yy_user_record表 可以先手動填入幾條數據信息 初始數據庫信息 username為用戶賬號 sex為用戶注冊所填寫的性別 phone為用戶手機號 time為用戶登錄該系統的時間 二、頁面的設計 登錄注冊頁面我就不演示了,前幾篇博文…

leetcode 455. 分發餅干 思考分析

目錄題目自己的思路以及AC代碼參考思路題目 假設你是一位很棒的家長,想要給你的孩子們一些小餅干。但是,每個孩子最多只能給一塊餅干。 對每個孩子 i,都有一個胃口值 g[i],這是能讓孩子們滿足胃口的餅干的最小尺寸;并…

c++ cdi+示例_C ++'not'關鍵字和示例

c cdi示例"not" is an inbuilt keyword that has been around since at least C98. It is an alternative to ! (Logical NOT) operator and it mostly uses with the conditions. “ not”是一個內置關鍵字,至少從C 98起就存在。 它是替代! …

【second】Flatten Binary Tree to Linked List

遞歸 void flatten(TreeNode *root) {// Note: The Solution object is instantiated only once and is reused by each test case.flat(root);}TreeNode* flat(TreeNode* root){if(!root)return NULL;TreeNode* left_tail flat(root->left);TreeNode* right_tail flat(ro…

八、流水查詢---記錄紡織品出庫信息

一、數據庫的建立 在fiber_yy數據庫下創建yy_textile_record表 可以先手動填入幾條數據信息 初始數據庫信息 第一條數據的username是空格不是null number為織物的品號(唯一的) stock為出貨量 username為哪個賬號 time為出貨時間 二、頁面的完善 登錄注冊頁面我就不演示…

應用程序欄【WP7學習札記之九】

本節是WP7學習札記的第九篇,講的是系統托盤和應用程序欄,具體內容是系統托盤和應用程序欄的介紹,如何分別使用C#、xaml以及Expression Blend生成應用程序欄,應用程序欄的透明度以及對屏幕方向改變的支持。摘要如下: 系…

橢圓曲線密碼學導論pdf_橢圓曲線密碼學

橢圓曲線密碼學導論pdf歷史 (History) The use of elliptic curves in cryptography was advised independently by Neal Koblitz and Victor S. Miller in 1985. Elliptic curve cryptography algorithms entered large use from 2004 to 2005. 1985年, Neal Kobli…

leetcode 第 216 場周賽 整理

目錄1662. 檢查兩個字符串數組是否相等題目自己代碼5606. 具有給定數值的最小字符串題目自己代碼貪心算法1664. 生成平衡數組的方案數題目自己代碼動態規劃優化1665. 完成所有任務的最少初始能量題目思路1662. 檢查兩個字符串數組是否相等 題目 給你兩個字符串數組 word1 和 …

九、忘記密碼功能的實現

一、頁面設計 login頁面,和第二篇博文(用戶登錄和注冊)頁面基本一樣,只不過多了一個按鈕 其中忘記密碼?點我找回 為button3 retrieve_password頁面 change_password頁面 頁面如下: 二、數據庫 因為是忘記密碼,…

Android中對手機文件進行讀寫

參考張澤華視頻 (一)讀寫手機內存卡中的文件 對手機中的文件進行讀寫操作,或者新增一個文件時,可直接使用openFileOutput / openFileInput 得到文件的輸出、輸入流。 FileOutputStream fos this.openFileOutput("private.…

聯軸器選型_聯軸器| 軟件工程

聯軸器選型耦合 (Coupling) In general terms, the term coupling is defined as a thing that joins together two objects. If we talk about software development, then the term coupling is related to the connection between two modules, i.e. how tight interaction …

劍指 Offer 10- I. 斐波那契數列 (從重疊子問題到備忘錄到dp數組迭代解法)

目錄題目描述1、暴力遞歸法的重疊子問題2、備忘錄解法3、dp數組迭代算法4、滾動數組優化5、參考鏈接題目描述 寫一個函數,輸入 n ,求斐波那契(Fibonacci)數列的第 n 項。斐波那契數列的定義如下: F(0) 0, F(1) 1 F…

C# 收郵件

C#沒有內置收郵件的類,參考網絡上的代碼,針對POP3協議服務器使用 Jmail組件來收郵件,針對IMAP協議服務器使用LumiSoft.Net 。 另外,一般免費郵箱需要在郵箱設置中開啟 POP3(或IMAP)、 SMTP服務才可以使用非…