예제 #1
0
        public DataSet FindEanByBarcode(string barcode)
        {
            DataSet dataSet       = new DataSet();
            string  commandString = "SELECT artcode, ean13, names FROM SPREAN WHERE ean13 = @Barcode";

            using (SqlCeConnection connection = new ManagerDb().GetConnect())
            {
                connection.Open();
                using (SqlCeCommand command = connection.CreateCommand())
                {
                    using (SqlCeDataAdapter adapter = new SqlCeDataAdapter())
                    {
                        adapter.SelectCommand.CommandType = CommandType.Text;
                        adapter.SelectCommand.CommandText = commandString;
                        adapter.SelectCommand.Parameters.AddWithValue("@Barcode", barcode);
                        adapter.TableMappings.Add("Table", "FoundedEan");
                        adapter.Fill(dataSet);
                    }
                }
            }
            return(dataSet);
        }