当前位置:网站首页>5、 Improvement of inventory query function
5、 Improvement of inventory query function
2022-06-13 01:41:00 【Beyond proverb】
One 、 The establishment of database
Due to the query function and the previous Warehousing management function The databases used are the same , Still used here yy_textile surface
stay fiber_yy Create... Under database yy_textile surface 

Initial database information 
Two 、 Page perfection
I won't show you on the login page , The previous blog posts also introduced
query Query page 
main_page The function of the page is improved 
3、 ... and 、 Code implementation
query Query page
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(" Query according to the fabric name ");
comboBox1.Items.Add(" Query according to the product number ");
}
private void button1_Click(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection(constr);
conn = new SqlConnection(constr);
mDataAdapter = new SqlDataAdapter("SELECT name AS ' Name of textile ',number AS ' Textile product No ',warp_density AS ' Density ' ,weft_density AS ' Weft density ',warp_linear_density AS ' Warp yarn density ',weft_linear_density AS ' Weft yarn density ',material AS ' Ingredients ',square_meter_weight AS ' Weight per square meter ',width_of_cloth AS ' width of cloth ',horse_length AS ' Horse length ',organization AS ' Organization used ',stock AS ' Inventory ' FROM yy_textile", conn);
dsall = new DataSet();
mDataAdapter.Fill(dsall, "hard");
dataGridView1.DataSource = dsall.Tables["hard"];
}
catch
{
MessageBox.Show(" Read failed , Please check if the fabric is present ");
}
}
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 Statement is executed according to specified conditions
if (model == " Query according to the fabric name ")
{
cmd.CommandText = "select * from yy_textile where name='" + command + "'";
model = "SELECT name AS ' Name of textile ',number AS ' Textile product No ',warp_density AS ' Density ' ,weft_density AS ' Weft density ',warp_linear_density AS ' Warp yarn density ',weft_linear_density AS ' Weft yarn density ',material AS ' Ingredients ',square_meter_weight AS ' Weight per square meter ',width_of_cloth AS ' width of cloth ',horse_length AS ' Horse length ',organization AS ' Organization used ',stock AS ' Inventory ' from yy_textile where name='" + command + "'";
}
if (model == " Query according to the product number ")
{
cmd.CommandText = "select * from yy_textile where number='" + command + "'";
model = "SELECT name AS ' Name of textile ',number AS ' Textile product No ',warp_density AS ' Density ' ,weft_density AS ' Weft density ',warp_linear_density AS ' Warp yarn density ',weft_linear_density AS ' Weft yarn density ',material AS ' Ingredients ',square_meter_weight AS ' Weight per square meter ',width_of_cloth AS ' width of cloth ',horse_length AS ' Horse length ',organization AS ' Organization used ',stock AS ' Inventory ' from yy_textile where number='" + command + "'";
}
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
object o = sdr["picture"];
MyData = (byte[])sdr["picture"];// Read the bit stream of the first picture
MemoryStream memoryStream = null;
memoryStream = new MemoryStream(MyData);
pictureBox1.Image = Image.FromStream(memoryStream);// Assign pictures to pictureBox1 Control
MessageBox.Show(" Read successful ");
conn = new SqlConnection(constr);
mDataAdapter = new SqlDataAdapter(model, conn);
dsall = new DataSet();
mDataAdapter.Fill(dsall, "hard");
dataGridView1.DataSource = dsall.Tables["hard"];
}
catch
{
MessageBox.Show(" Read failed , Please check if the fabric is present ");
}
}
}
}
main_page 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(" Quit successfully ");
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();
}
}
}
Four 、 Effect demonstration
The program runs 
I won't demonstrate if I register , Please refer to the previous blog posts
from yy_user Find an account and password in the table , Direct user login 

Login successful 
Entry system 
demonstration Inventory query


Refer to all fabric information included 
Accurate search
Query according to the fabric name 


Query according to the product number 

边栏推荐
- 四、入库管理功能的完善
- C language implementation of the classic eight queens problem
- 【软考】软件设计师知识点整理(待更新)
- Implementation and design of JMeter interface test database assertion for CSDN salary increase technology
- Leetcode 01 array
- Web Application & applet application deployment
- This of phaser3 add. sprite
- 如何利用您的自有数据来实现营销目标?
- Leetcode question brushing 06 bit operation
- Leetcode question brushing 04 string
猜你喜欢

三、上传织物图片至SQL Server并提供name进行展示织物照片

Should the audience choose observation mode or positioning mode?

Network communication tcp/ip
![[leetcode] valid phone number Bash](/img/f8/cecb74f9d8f7c589e62e3a9a874f82.jpg)
[leetcode] valid phone number Bash

Workspace for ROS

TensorFlow2的Conv1D, Conv2D,Conv3D机器对应的MaxPooling详解

【斯坦福计网CS144项目】Lab1: StreamReassembler

ES6 deconstruction assignment

项目实训(十七)---个人工作总结

Leetcode question brushing 02 linked list operation
随机推荐
一种不带CPU的DPU架构:Hyperion
[pytorch FAQ] numpy:dll load failed while importing_ multiarray_ Umath: the specified module could not be found.
Developer contributions amd Xilinx Chinese Forum sharing - wisdom of questioning
MySQL ---- where后使用字段别名
他山之石:a16z 的 Web3 投资版图
Startup, connection and stop of MySQL service
Differences among bio, NiO and AIO
Transaction characteristics and isolation levels
五、库存查询功能的完善
Simple operation of MySQL database
Temporary objects and compilation optimization
About tkinter Canvas does not display pictures
Numpy multidimensional array transpose transpose
Tweets movement description and chart display
FSOs forest simulation optimization model learning notes
TensorFlow2的Conv1D, Conv2D,Conv3D机器对应的MaxPooling详解
The second round of mesa
如何利用您的自有数据来实现营销目标?
Topic creation and running example of ROS
About the proposed signature file migration to industry standard format pkcs12