Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using MySql.Data.MySqlClient;
- namespace MySQLSmaple {
- class Program {
- static void Main(string[] args) {
- using (var con = new MySqlConnection(
- "server=localhost;user=hilapon;password=xxxxxxxx;database=sample_db;")) {
- con.Open();
- var command = new MySqlCommand("select * from Shops where shop_name like 'C%';", con);
- var reader = command.ExecuteReader();
- while (reader.Read()) {
- Console.WriteLine("----------------------------------");
- Console.WriteLine(
- $"| {reader["shop_id"]} | {reader["shop_name"]} | {reader["rating"]} | {reader["area"]} |"
- );
- }
- }
- Console.WriteLine("----------------------------------");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement