sql语句修改
This commit is contained in:
commit
4324fdd74b
5 files changed
+24
-24
No files matched your search
@@ -76,7 +76,7 @@ namespace formula_manage.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void GridSql()
|
private async void GridSql()
|
||||||
{
|
{
|
||||||
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ namespace formula_manage.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
Dissolve_sql = "SELECT count(*) FROM [Dispensing].[dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
|
Dissolve_sql = "SELECT count(*) FROM [dbo].[Dissolve] WHERE DissolveCode = '" + Code.Text + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(Dissolve_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -172,7 +172,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
Dissolve_sql = string.Format("INSERT INTO[Dispensing].[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
|
Dissolve_sql = string.Format("INSERT INTO[dbo].[Dissolve](DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX) " +
|
||||||
"VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','"+ min.Text + "','" + max.Text + "')");
|
"VALUES ('" + Code.Text + "','" + name.Text + "','" + Remark.Text + "','" + int_ion + "','"+ min.Text + "','" + max.Text + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(Dissolve_sql, conn_SC);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace formula_manage.Windows
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE]";//查询语句
|
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -95,7 +95,7 @@ namespace formula_manage.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void GridSql()
|
private async void GridSql()
|
||||||
{
|
{
|
||||||
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [Dispensing].[dbo].[MACHINE]";//查询语句
|
string MAC_sql = "SELECT Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note FROM [dbo].[MACHINE]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ namespace formula_manage.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
MAC_sql = "SELECT count(*) FROM [Dispensing].[dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
|
MAC_sql = "SELECT count(*) FROM [dbo].[MACHINE] WHERE Name = '" + Mac_name + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(MAC_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(MAC_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -183,7 +183,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
MAC_sql = string.Format("INSERT INTO[Dispensing].[dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " +
|
MAC_sql = string.Format("INSERT INTO [dbo].[MACHINE](Name ,MacGroup ,Capacity ,Volume ,Industry ,Categories ,Note ) " +
|
||||||
"VALUES ('" + Mac_name + "','" + Mac_group + "'," + Mac_capacity + "," + Mac_volume + "," + Mac_industry + "," + Mac_categories + ",'" + Mac_note + "')");
|
"VALUES ('" + Mac_name + "','" + Mac_group + "'," + Mac_capacity + "," + Mac_volume + "," + Mac_industry + "," + Mac_categories + ",'" + Mac_note + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(MAC_sql, conn_SC);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace formula_manage.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void GridSql()
|
private async void GridSql()
|
||||||
{
|
{
|
||||||
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [Dispensing].[dbo].[Dissolve]";//查询语句
|
string Dissolve_sql = "SELECT DissolveCode ,DissolveName ,REMARK ,MaterialType ,WeightMIN ,WeightMAX FROM [dbo].[Dissolve]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace formula_manage.Windows
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
string Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -128,11 +128,11 @@ namespace formula_manage.Windows
|
|||||||
private async void GridSql(int e )
|
private async void GridSql(int e )
|
||||||
{
|
{
|
||||||
string Stuff_sql = null;
|
string Stuff_sql = null;
|
||||||
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT]";//查询语句
|
if (e == 0) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT]";//查询语句
|
||||||
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '0' ";
|
else if (e == 1) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '0' ";
|
||||||
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '1' ";
|
else if (e == 2) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '1' ";
|
||||||
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '2' ";
|
else if (e == 3) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '2' ";
|
||||||
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [Dispensing].[dbo].[PRODUCT] Where ProductType = '3' ";
|
else if (e == 4) Stuff_sql = "SELECT ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ,ProductIon_Type FROM [dbo].[PRODUCT] Where ProductType = '3' ";
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ namespace formula_manage.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
Stuff_sql = "SELECT count(*) FROM [Dispensing].[dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
|
Stuff_sql = "SELECT count(*) FROM [dbo].[PRODUCT] WHERE ProductCode = '" + Product_Code + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(Stuff_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -242,7 +242,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
Stuff_sql = string.Format( "INSERT INTO[Dispensing].[dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
|
Stuff_sql = string.Format( "INSERT INTO [dbo].[PRODUCT](ProductCode ,ProductName , Price , SUPPLIER ,ProductType ,Color ,Concentration , GRAVITY ) " +
|
||||||
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
|
"VALUES ('" + Product_Code + "','" + Product_Name + "','" + _Price + "','" + _SUPPLIER + "','" + int_stuff_ProductType + "','" + ColorCode_SQL + "','" + _Concentration + "','" + _GRAVITY + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(Stuff_sql, conn_SC);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace formula_manage.Windows
|
|||||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fabric_sql = "SELECT Code ,Name , GYard , Remark FROM [Dispensing].[dbo].[PRODUCTION_Material]";//查询语句
|
string fabric_sql = "SELECT Code ,Name , GYard , Remark FROM [dbo].[PRODUCTION_Material]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
@@ -98,7 +98,7 @@ namespace formula_manage.Windows
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async void GridSql()
|
private async void GridSql()
|
||||||
{
|
{
|
||||||
string fabric_sql = "SELECT Code ,Name , GYard , Remark FROM [Dispensing].[dbo].[PRODUCTION_Material]";//查询语句
|
string fabric_sql = "SELECT Code ,Name , GYard , Remark FROM [dbo].[PRODUCTION_Material]";//查询语句
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ namespace formula_manage.Windows
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
fabric_sql = "SELECT count(*) FROM [Dispensing].[dbo].[PRODUCTION_Material] WHERE Code = '" + fabric_code.Text + " '";//查询语句
|
fabric_sql = "SELECT count(*) FROM [dbo].[PRODUCTION_Material] WHERE Code = '" + fabric_code.Text + " '";//查询语句
|
||||||
await conn_SC.OpenAsync(); //打开数据连
|
await conn_SC.OpenAsync(); //打开数据连
|
||||||
SqlCommand cmd = new SqlCommand(fabric_sql, conn_SC); //查询记录数
|
SqlCommand cmd = new SqlCommand(fabric_sql, conn_SC); //查询记录数
|
||||||
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
int count = Convert.ToInt32(cmd.ExecuteScalar()); //显示记录数
|
||||||
@@ -146,7 +146,7 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
fabric_sql = string.Format("INSERT INTO[Dispensing].[dbo].[PRODUCTION_Material](Code ,Name , GYard , Remark) " +
|
fabric_sql = string.Format("INSERT INTO [dbo].[PRODUCTION_Material](Code ,Name , GYard , Remark) " +
|
||||||
"VALUES ('" + fabric_code.Text + "','" + fabric_name.Text + "','" + fabric_GYard.Text + "','" + fabric_Remark.Text + "')");
|
"VALUES ('" + fabric_code.Text + "','" + fabric_name.Text + "','" + fabric_GYard.Text + "','" + fabric_Remark.Text + "')");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
|
||||||
@@ -165,7 +165,7 @@ namespace formula_manage.Windows
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fabric_sql = string.Format("UPDATE [Dispensing].[dbo].[PRODUCTION_Material] SET Name='" + fabric_name.Text + "',GYard='" + fabric_GYard.Text + "',Remark='" + fabric_Remark.Text + "' Where Code='"+ fabric_code.Text + "'");
|
fabric_sql = string.Format("UPDATE [dbo].[PRODUCTION_Material] SET Name='" + fabric_name.Text + "',GYard='" + fabric_GYard.Text + "',Remark='" + fabric_Remark.Text + "' Where Code='"+ fabric_code.Text + "'");
|
||||||
await conn_SC.OpenAsync(); //打开数据连接
|
await conn_SC.OpenAsync(); //打开数据连接
|
||||||
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
|
SqlCommand INSERT_cmd = new SqlCommand(fabric_sql, conn_SC);
|
||||||
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
int sql_in = INSERT_cmd.ExecuteNonQuery(); //执行语句
|
||||||
@@ -193,12 +193,12 @@ namespace formula_manage.Windows
|
|||||||
|
|
||||||
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
{
|
{
|
||||||
string ShowProductName = "是否删除【" + this.fabric_name.Text + "】" + this.fabric_code.Text;//获取原料信息并拼接提示字符串
|
string ShowProductName = "是否删除【" + this.fabric_name.Text + "】" + this.fabric_code.Text;//获取信息并拼接提示字符串
|
||||||
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
|
MessageBoxResult showProductName = System.Windows.MessageBox.Show(ShowProductName, "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes);//弹窗提示是否删除目标原料
|
||||||
if (showProductName == MessageBoxResult.Yes)//判断是否删除原料
|
if (showProductName == MessageBoxResult.Yes)//判断是否删除
|
||||||
{
|
{
|
||||||
|
|
||||||
string Stuff_sql = string.Format("DELETE FROM [Dispensing].[dbo].[PRODUCTION_Material] WHERE Code ='" + fabric_code.Text.ToString() + "'");
|
string Stuff_sql = string.Format("DELETE FROM [dbo].[PRODUCTION_Material] WHERE Code ='" + fabric_code.Text.ToString() + "'");
|
||||||
|
|
||||||
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
SqlConnection conn_SC = new SqlConnection(Connstr_SC); //实例化
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in new issue
Block a user