@ -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 ) ;