1234567891011121314151617181920212223242526272829 |
- using Dapper;
- using MySqlConnector;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace wpf_connection3
- {
- public class DBDataProvider : IDataProvider
- {
- static string connectionString = "Server=kolei.ru; User ID=aleuhin; Password=101005; Database=aleuhin";
- public IEnumerable<Product> getProduct()
- {
- using (MySqlConnection db = new MySqlConnection(connectionString))
- {
- return db.Query<Product>(
- "SELECT p.ID, p.Title, p.ProductTypeID, p.ArticleNumber, p.Image, pt.Title AS ProductTypeTitle " +
- "FROM Product p, ProductType pt " +
- "WHERE p.ProductTypeID=pt.ID")
- .ToList();
- }
- }
- }
- }
|