Ejemplo n.º 1
0
        public void IDExists(string Product_ID)
        {
            bool Product_ID_Inuse = false;

            using (SqlConnection con = new SqlConnection("Persist Security Info=False;User ID=sa;Password=admin;Initial Catalog=Product_Catalogue;Data Source=192.168.0.153"))
            {
                SqlCommand cmd = new SqlCommand("spIDExists", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Product_ID", Product_ID);
                //cmd.Parameters.Add(new SqlParameter()
                //{
                //    ParameterName = @Product_ID,
                //    Value=Product_ID


                //});


                con.Open();
                Product_ID_Inuse = Convert.ToBoolean(cmd.ExecuteScalar());
            }


            CheckProduct chk = new CheckProduct();

            chk.Product_ID       = Product_ID;
            chk.Product_ID_Inuse = Product_ID_Inuse;
            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Write(js.Serialize(chk));
        }
Ejemplo n.º 2
0
        public void IDExists(string Product_ID)
        {
            bool Product_ID_Inuse = false;
            using (SqlConnection con = new SqlConnection("Persist Security Info=False;User ID=sa;Password=admin;Initial Catalog=Product_Catalogue;Data Source=192.168.0.153"))
               {

               SqlCommand cmd = new SqlCommand("spIDExists", con);
               cmd.CommandType = CommandType.StoredProcedure;

               cmd.Parameters.AddWithValue("@Product_ID", Product_ID);
               //cmd.Parameters.Add(new SqlParameter()
               //{
               //    ParameterName = @Product_ID,
               //    Value=Product_ID

               //});

               con.Open();
               Product_ID_Inuse = Convert.ToBoolean(cmd.ExecuteScalar());
               }

            CheckProduct chk = new CheckProduct();
            chk.Product_ID = Product_ID;
            chk.Product_ID_Inuse = Product_ID_Inuse;
            JavaScriptSerializer js = new JavaScriptSerializer();
            Context.Response.Write(js.Serialize(chk));
        }