Fetch the repository succeeded.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 药品工作站
{
public partial class 库存报警 : Form
{
public 库存报警()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
BindData();
}
public void BindData()
{
SqlConnection sqlConnection = new SqlConnection();
sqlConnection.ConnectionString =
"Server=(local);Database=药品工作站管理系统;Integrated Security=sspi";
SqlCommand sqlCommand = sqlConnection.CreateCommand();
sqlCommand.CommandText = "SELECT * FROM 药品信息;";
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
sqlDataAdapter.SelectCommand = sqlCommand;
sqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataTable Table1 = new DataTable();
sqlConnection.Open();
sqlDataAdapter.Fill(Table1);
sqlConnection.Close();
dgv.DataSource = Table1;
}
private void 库存报警_Load(object sender, EventArgs e)
{
BindData();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void dgv_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
try
{
decimal num = Convert.ToDecimal(this.dgv.Rows[e.RowIndex].Cells[9].Value.ToString());
decimal yj = Convert.ToDecimal(txtYJ.Text.Trim());
if (num < yj)
{
this.dgv.Rows[e.RowIndex].Cells[9].Style.ForeColor = Color.Red;
}
}
catch
{
}
}
private void label6_Click(object sender, EventArgs e)
{
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。