עליך להתחבר בכדי להוריד קבצים מהאתר
על מנת להבטיח שמשאבינו לא ינוצלו לרעה.
1 : public int Insert(Website website)
2 : {
3 : int records = 0;
4 : StringBuilder sql_builder = new StringBuilder();
5 : sql_builder.AppendFormat("INSERT INTO Website (Name,
6 : LogoLink, Link) VALUES ('{0}','{1}', '{2}') ",
7 : website.Name, website.LogoLink,website.Link);
8 : try
9 : {
10 : command.CommandText = sql_builder.ToString();
11 : connection.Open();
12 : records = command.ExecuteNonQuery();
13 : }
14 : catch(Exception e)
15 : {
16 :
17 : }
18 : finally
19 : {
20 : connection.Close();
21 : }
22 : return records;
23 : }
1 : public int Update(Website website)
2 : {
3 : int records = 0;
4 : StringBuilder sql_builder = new StringBuilder();
5 : sql_builder.AppendFormat("UPDATE Website SET Name='{0}', LogoLink='{1}', Link ='{2}' WHERE WebsiteID = {3}",
6 : website.Name, website.LogoLink, website.Link, website.WebsiteID);
7 : try
8 : {
9 : command.CommandText = sql_builder.ToString();
10 : connection.Open();
11 : records = command.ExecuteNonQuery();
12 : }
13 : catch (Exception e)
14 : {
15 :
16 : }
17 : finally
18 : {
19 : connection.Close();
20 : }
21 : return records;
22 : }
1 : public int Delete(Website website)
2 : {
3 : int records = 0;
4 : StringBuilder sql_builder = new StringBuilder();
5 : sql_builder.AppendFormat("DELETE FROM Website WHERE
6 : WebsiteID = {0}", website.WebsiteID);
7 : try
8 : {
9 : command.CommandText = sql_builder.ToString();
10 : connection.Open();
11 : records = command.ExecuteNonQuery();
12 : }
13 : catch (Exception e)
14 : {
15 :
16 : }
17 : finally
18 : {
19 : connection.Close();
20 : }
21 : return records;
22 : }