Advertisement

01.03.2008 at 12:48AM PST, ID: 23055059
[x]
Attachment Details

System.Collections.Generic namespace

Asked by thomas908 in Visual Studio .NET 2003, Programming for ASP.NET, Visual Studio .NET 2005

Tags: 2003, using

We had created some webservice using Visual Studio 2005, which used the namespace System.Collections.Generic.
Now due to some reason we need to compile that code in Visual Studio 2003 but since this namespace does not exist in .net2003 we are getting a compile time error. What can I do to resolve this problem.

Here is my code
Start Free Trial
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:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
using System.Collections.Generic;
 
public class chapter
        {
 
            public string tpr_uid;
 
            public float price;
 
        } 
 
[WebMethod]
        public string AddSampleResources(int UserID, int SiteID, int RelativeExpiration, string TransactionID, List<chapter> lst, out string sErrorMessage)
        {
            string b_uid = "";
            string status = "Success";
            string FirstName = "";
            string LastName = "";
            string UserEmail = "";
            string sSelectStmt ="";
            int affectedrows = 0;
            DataView dtvUserInfo = new DataView();
            sErrorMessage = "";
            
            try
            {
                if (UserID.Equals(0) || SiteID.Equals(0) || lst.Equals(""))
                {
                    sErrorMessage = "Incomplete Data.";
                    status = "Failed";
                }
 
                if (RelativeExpiration.Equals(0))
                {
                    RelativeExpiration = 365;
                }
                DateTime today = DateTime.Now;
                //Calculating ExpirationDate
                DateTime ExpirationDate = today.AddDays(RelativeExpiration);
 
                string connstr = System.Configuration.ConfigurationSettings.AppSettings.Get("ConnString");
                SqlConnection conn = new SqlConnection(connstr);
 
                int i = 0;
                int j = 0;
 
 
                
                sSelectStmt = "select UserEmail,FirstName,LastName from tblUserProfile(nolock) where UserID= '" + UserID + "'";
                dtvUserInfo = DML.GetRecords(sSelectStmt, connstr);
 
                if (dtvUserInfo.Count == 0)
                {
                    sErrorMessage = "User not found";
                    status = "Failed";
                }
 
                
 
                UserEmail = dtvUserInfo[0]["UserEmail"].ToString();
                FirstName = dtvUserInfo[0]["FirstName"].ToString();
                LastName = dtvUserInfo[0]["LastName"].ToString();
                
               
 
                while (j < lst.Count)
                {
                    if (lst.Count - j == 1)
                    {
                        b_uid = b_uid + lst[j].tpr_uid;
                    }
                    else
                    {
                        b_uid = b_uid + lst[j].tpr_uid + ",";
                    }
                    j++;
                }
 
 
                while (i < lst.Count)
                {
                    SqlCommand cmd = new SqlCommand("Insert into tblContentAssignments values('" + SiteID + "' ,'" + UserID + "' ,'" + lst[i].tpr_uid + "','" + TransactionID + "','" + DateTime.Now + "','" + RelativeExpiration + "','" + ExpirationDate + "',convert(money,'" + lst[i].price + "')) ", conn);//Insert into tblContentAssignment
                    conn.Open();
                    affectedrows = affectedrows+ cmd.ExecuteNonQuery();
                    conn.Close();
 
                    i++;
 
                }
 
                if (affectedrows < lst.Count)
                {
                    status = "Failed";
                }
            }
 
 
            catch (SqlException ex)
            {
 
                WriteEvent(ex, UserID, SiteID, b_uid, UserEmail, FirstName, LastName);
                status = "Failed";
            }
            return status;
        }
 
        void WriteEvent(SqlException ex, int UserID, int SiteID, string b_uid, string UserEmail, string FirstName, string LastName)
        {
            EventLog ev = new EventLog("Application");
            // Event's Source name
            ev.Source = ex.Source;
            if (!EventLog.SourceExists(ev.Source))
                //EventLog.CreateEventSource(ev.Source, sLog);
                EventLog.CreateEventSource(ev.Source, "Application");
 
 
            ev.WriteEntry("UserName:'" + FirstName + "' '" + LastName + "'  UserID:'" + UserID + "' SiteID:'" + SiteID + "'  tpr_uid:'" + b_uid + "' Exception:'" + ex.Message + "' ErrorCode:'" + ex.ErrorCode + "'  ");
 
 
            ev = null;
            MailMessage objMail = new MailMessage();
            objMail.From = "admin@tprpub.com";
            objMail.To = "transaction@tprpub.com";
            objMail.Subject = "Subject: Error Information";
 
            objMail.Body = "Here is your requested info: " + "\n" +
                                "FirstName " + FirstName + "\n" +
                                "LastName " + LastName + "\n" +
                                "UserID " + UserID + "\n" +
                                "SiteID " + SiteID + "\n" +
                                "Email " + UserEmail + "\n" +
            "tpr_uid  '" + b_uid + "' ErrorCode: '" + ex.ErrorCode + "'";
            objMail.Priority = MailPriority.High;
 
 
            SmtpMail.SmtpServer = "...";
            SmtpMail.Send(objMail);
        }
[+][-]01.03.2008 at 12:51AM PST, ID: 20571423

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.03.2008 at 12:53AM PST, ID: 20571430

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.03.2008 at 01:24AM PST, ID: 20571537

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.03.2008 at 01:28AM PST, ID: 20571560

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2003, Programming for ASP.NET, Visual Studio .NET 2005
Tags: 2003, using
Sign Up Now!
Solution Provided By: asvforce
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.03.2008 at 09:54AM PST, ID: 20574866

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628