当前位置:网站首页>4、 Improvement of warehousing management function
4、 Improvement of warehousing management function
2022-06-13 01:41:00 【Beyond proverb】
One 、 Database creation
stay fiber_yy Create... Under database yy_textile surface
Just add a few pieces of data
Two 、 Page perfection
I won't show you on the login page , The previous blog posts also introduced
warehousing Warehousing page
main_page The function of the page is improved
3、 ... and 、 Code implementation
warehousing 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 warehousing : Form
{
public string constr = "server=CY-20190824RMES;Initial Catalog=fiber_yy;User ID=sa;pwd=beyond";
public warehousing()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog ofdlgTest = new OpenFileDialog();
//ofdlgTest.Filter = "*.jpg|*.png"; // File filtering Filter files that can be opened
ofdlgTest.Filter = "";
ofdlgTest.Multiselect = false; // Set that multiple files cannot be selected
// The file open dialog box is displayed
DialogResult result = ofdlgTest.ShowDialog();
// When selecting the open button , Display the file name in the text box
if (result == DialogResult.OK) // Determine whether to open the file
{
this.textBox11.Text = ofdlgTest.FileName;
pictureBox1.Image = Image.FromFile(ofdlgTest.FileName);
}
}
private void button1_Click(object sender, EventArgs e)
{
try
{
string path = textBox11.Text;
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); // Add the picture of the specified path to FileStream Class
BinaryReader br = new BinaryReader(fs);// adopt FileStream Object instantiation BinaryReader object
byte[] imgBytesIn = br.ReadBytes(Convert.ToInt32(fs.Length));// Convert pictures to binary data
//Save(imgBytesIn);// call ( A way to write by yourself )
SqlConnection conn = new SqlConnection(constr);
conn.Open();
string name = textBox1.Text;
int number = int.Parse(textBox2.Text);
float warp_density = float.Parse(textBox3.Text);
float weft_density = float.Parse(textBox4.Text);
float warp_linear_density = float.Parse(textBox5.Text);
float weft_linear_density = float.Parse(textBox6.Text);
string material = textBox7.Text;
float square_meter_weight = float.Parse(textBox8.Text);
float width_of_cloth = float.Parse(textBox9.Text);
float horse_length = float.Parse(textBox10.Text);
string organization = textBox12.Text;
int stock = int.Parse(textBox13.Text);
SqlCommand cmd = new SqlCommand("insert into yy_textile (name,number,warp_density,weft_density,warp_linear_density,weft_linear_density,material,square_meter_weight,width_of_cloth,horse_length,picture,organization,stock) " +
"values(@name,@number,@warp_density,@weft_density,@warp_linear_density,@weft_linear_density,@material,@square_meter_weight,@width_of_cloth,@horse_length,@picture,@organization,@stock);", conn); //SQL sentence
cmd.Parameters.Add("@name", SqlDbType.VarChar);
cmd.Parameters["@name"].Value = name;
cmd.Parameters.Add("@number", SqlDbType.Int);
cmd.Parameters["@number"].Value = number;
cmd.Parameters.Add("@warp_density", SqlDbType.Float);
cmd.Parameters["@warp_density"].Value = warp_density;
cmd.Parameters.Add("@weft_density", SqlDbType.Float);
cmd.Parameters["@weft_density"].Value = weft_density;
cmd.Parameters.Add("@warp_linear_density", SqlDbType.Float);
cmd.Parameters["@warp_linear_density"].Value = warp_linear_density;
cmd.Parameters.Add("@weft_linear_density", SqlDbType.Float);
cmd.Parameters["@weft_linear_density"].Value = weft_linear_density;
cmd.Parameters.Add("@material", SqlDbType.VarChar);
cmd.Parameters["@material"].Value = material;
cmd.Parameters.Add("@square_meter_weight", SqlDbType.Float);
cmd.Parameters["@square_meter_weight"].Value = square_meter_weight;
cmd.Parameters.Add("@width_of_cloth", SqlDbType.Float);
cmd.Parameters["@width_of_cloth"].Value = width_of_cloth;
cmd.Parameters.Add("@horse_length", SqlDbType.Float);
cmd.Parameters["@horse_length"].Value = horse_length;
cmd.Parameters.Add("@picture", SqlDbType.Image);
cmd.Parameters["@picture"].Value = imgBytesIn;
cmd.Parameters.Add("@organization", SqlDbType.VarChar);
cmd.Parameters["@organization"].Value = organization;
cmd.Parameters.Add("@stock", SqlDbType.Int);
cmd.Parameters["@stock"].Value = stock;
cmd.ExecuteNonQuery();
conn.Close();
MessageBox.Show(" Image upload succeeded ");
}
catch
{
MessageBox.Show(" Please check the input information ");
}
}
private void button3_Click(object sender, EventArgs e)
{
new main_page().Show();
this.Hide();
}
}
}
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
First demonstrate Warehousing management function
Put in storage
边栏推荐
- MySQL download and installation
- Happy string
- [从零开始学习FPGA编程-21]:进阶篇 - 架构 - VerilogHDL编码规范
- leetcode743. 网络延迟时间(中等, dijkstra)
- 项目实训(十七)---个人工作总结
- Wildcard usage of go standard library FMT
- Lecture on Compilation Principles
- [andoid][step pit]cts 11_ Testbootclasspathandsystemserverclasspath at the beginning of R3_ Analysis of nonduplicateclasses fail
- 谷歌的受众群体是如何发挥作用的?
- Golang learning essay
猜你喜欢
Traversal of binary tree - first order traversal, middle order traversal, and second order traversal
关于tkinter.Canvas 不显示图片的问题
Workspace for ROS
30: Kakfa simulates JSON data generation and transmission
[Stanford Jiwang cs144 project] lab1: streamreassembler
Use koa to mock data and set cross domain issues
Uuid/guid introduction, generation rules and generation codes
Tweets movement description and chart display
Crypto JS reports uglifyjs error
Jeux de plombiers
随机推荐
Summary of various installation methods of Lab View
Golang inline mechanism & go development test
MySQL ---- where后使用字段别名
Note: common gadgets in project architecture
How to solve the problems when using TV focusable to package APK in uni app
ES6解构赋值
[pytorch FAQ] numpy:dll load failed while importing_ multiarray_ Umath: the specified module could not be found.
[learn FPGA programming from scratch -21]: Advanced - Architecture - VerilogHDL coding specification
Record the VMware installation process of VMware Tools and some problems encountered
兴趣相似的受众群体
Cmake has no obvious error after compilation, but prompts that pthread cannot be found
How many times does the constructor execute?
Lecture on Compilation Principles
About inquirerjs
Transaction characteristics and isolation levels
路径字段是什么? ——竞价广告
FSOs forest simulation optimization model learning notes
Network communication tcp/ip
谷歌的智能出价有几种?
Jeux de plombiers