Friday, February 4, 2011

c# - continuing app : Insert Mod.

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Data.SqlClient;
6
7 namespace PageControlRegistry
8 {
9 class Operations
10 {
11 public int CreateObject(string strSYME_PAGE, string strSYOB_OBJECTNAME, string strSYOB_OBJECTLABEL, int intSYOB_OBJECTTYPE)
12 {
13 SqlCommand cmdcommand = null;
14 Connection modCon;
15 string SQLString;
16 try
17 {
18 modCon = new Connection();
19 cmdcommand = new SqlCommand();
20 cmdcommand.Connection = modCon.runCon();
21 SQLString = "insert into app_menu_object";
22 SQLString += " (SYME_SEQ, SYME_PAGE, SYOB_OBJECTNAME, SYOB_OBJECTLABEL, SYOB_OBJECTTYPE, SYOB_OBJECTTYPEDESC)";
23 SQLString += " SELECT SYME_SEQ, '" + strSYME_PAGE + "', '" + strSYOB_OBJECTNAME + "', '" + strSYOB_OBJECTLABEL + "', ";
24 SQLString += intSYOB_OBJECTTYPE + ", dbo.ITP_GetDescription('OBJ', '" + intSYOB_OBJECTTYPE + "')";
25 SQLString += " FROM app_menu WHERE ACTIVE = 1 AND SYME_URL LIKE '%/" + strSYME_PAGE + "'";
26 cmdcommand.CommandText = SQLString;
27 cmdcommand.ExecuteNonQuery();
28 cmdcommand.Connection.Close();
29 return 0;
30 }
31 catch
32 {
33 if (cmdcommand != null)
34 {
35 cmdcommand.Dispose();
36 }
37 return 1;
38 }
39 }
40 }
41 }

No comments:

Post a Comment