-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cs
51 lines (41 loc) · 1.48 KB
/
main.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 hotel_booking.SqlConn;
using System.Data.SqlClient;
using Hotel_booking;
namespace ConnectSQLServer
{
class main
{
static void Main(string[] args)
{
Console.WriteLine("Getting sql Connection ...");
SqlConnection conn = DBConnConfig.GetDBConnection();
try
{
Console.WriteLine("Openning sql Connection ...");
conn.Open();
//input: object[country, owner id, rating, description, location, hotel type, hotel name]
//output: true if data inserted successfully or false if smt went wrong
object[] hotelDataToInsert = new object[8];
hotelDataToInsert[0] = 1;
hotelDataToInsert[1] = 1;
hotelDataToInsert[2] = 2;
hotelDataToInsert[3] = "description";
hotelDataToInsert[4] = 155;
hotelDataToInsert[5] = 1;
hotelDataToInsert[6] = 1;
hotelDataToInsert[7] = "hotel name";
DBSystem sys = new DBSystem();
Authorized user = new Authorized();
sys.GetHotel(1);
user.AddHotel(hotelDataToInsert);
Console.WriteLine("Connection to the Hotel_DB was successful!");
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
}
Console.Read();
}
}
}