using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// Summary description for Produtos
/// </summary>
public class Produtos
{
	public Produtos()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public DataSet GetProdutos(string ProductName)
    {
        string ConStr = "Data Source=ASUS;Initial Catalog=Northwind;Integrated Security=True";
        string SQL = "SELECT ProductID, ProductName FROM Products " +
            "  WHERE ProductName like @ProductName";
        SqlConnection Con = new SqlConnection(ConStr);
        SqlCommand Cmd = new SqlCommand(SQL, Con);
        Cmd.Parameters.Add(new SqlParameter("@ProductName",
            SqlDbType.VarChar, 100, "ProductName"));
        Cmd.Parameters["@ProductName"].Value = ProductName + "%";
        SqlDataAdapter Adp = new SqlDataAdapter(Cmd);
        DataSet ds = new DataSet();
        Adp.Fill(ds);
        return ds;
   }


    public DataSet GetProduto(int ProcuctId)
    {
        string ConStr = "Data Source=ASUS;Initial Catalog=Northwind;Integrated Security=True";
        string SQL = "SELECT ProductID, ProductName FROM Products " +
            "  where ProductID = @ProductID";
        SqlConnection Con = new SqlConnection(ConStr);
        SqlCommand Cmd = new SqlCommand(SQL, Con);
        Cmd.Parameters.Add(new SqlParameter("@ProductID",
            SqlDbType.Int, 4, "ProductID"));
        Cmd.Parameters["@ProductID"].Value = ProcuctId;
        SqlDataAdapter Adp = new SqlDataAdapter(Cmd);
        DataSet ds = new DataSet();
        Adp.Fill(ds);
        return ds;
    }


}
