-
Notifications
You must be signed in to change notification settings - Fork 0
/
htl011.cs
51 lines (46 loc) · 1.36 KB
/
htl011.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Connector
{
class htl011
{
#region Properties
public int ProductID { set; get; }
public string ProductName { set; get; }
public double Price { set; get; }
#endregion Properties
public List<htl011> getall()
{
SqlConnection con = Gate.GetConnectionFront();
string Get = " select * from htl011 ";
SqlCommand cmd = new SqlCommand(Get, con);
List<htl011> lst = new List<htl011>();
try
{
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
htl011 _obj = new htl011();
_obj.ProductID = int.Parse(reader["ords"].ToString()); // bookid
_obj.ProductName = reader["roomtype"].ToString();
_obj.Price = int.Parse(reader["Price"].ToString());
lst.Add(_obj);
}
}
catch (SqlException ex)
{
throw ex;
}
finally
{
con.Close();
}
return lst;
}
}
}