Click here to Skip to main content
16,004,833 members
Home / Discussions / C#
   

C#

 
GeneralRe: TextBox Event Not Triggering Pin
DaveyM6911-Jan-08 8:19
professionalDaveyM6911-Jan-08 8:19 
GeneralRe: TextBox Event Not Triggering Pin
Thomas Stockwell11-Jan-08 14:51
professionalThomas Stockwell11-Jan-08 14:51 
Questionnamespace 'Windows' does not exist Pin
Steve Harp11-Jan-08 6:03
Steve Harp11-Jan-08 6:03 
GeneralRe: namespace 'Windows' does not exist Pin
Luc Pattyn11-Jan-08 6:08
sitebuilderLuc Pattyn11-Jan-08 6:08 
AnswerRe: namespace 'Windows' does not exist Pin
Steve Harp11-Jan-08 6:29
Steve Harp11-Jan-08 6:29 
GeneralRe: namespace 'Windows' does not exist Pin
Luc Pattyn11-Jan-08 6:34
sitebuilderLuc Pattyn11-Jan-08 6:34 
GeneralRe: namespace 'Windows' does not exist Pin
Steve Harp11-Jan-08 7:00
Steve Harp11-Jan-08 7:00 
GeneralProblem to DataTable.Rows.Remove(DataRow row) method. Pin
hdv21211-Jan-08 4:02
hdv21211-Jan-08 4:02 
hi i have a method as 'GetDbUsers' and i use it like this :
this.dt = this.GetDbUsers();
body of my method is :
private DataTable GetDbUsers()<br />
        {<br />
            string spName = "sp_helplogins";<br />
            SqlConnection con = new SqlConnection(GlobalUtil.GetConnectionString());<br />
            SqlCommand cmd = new SqlCommand(spName, con);<br />
            SqlDataReader dr;<br />
            DataTable dtDbUsers = new DataTable();<br />
            cmd.CommandType = CommandType.StoredProcedure;<br />
            try<br />
            {<br />
                if (con.State == ConnectionState.Closed)<br />
                    con.Open();<br />
                dr = cmd.ExecuteReader();<br />
                dtDbUsers.Load(dr);<br />
                foreach (DataRow row in dtDbUsers.Rows)<br />
                {<br />
                    if (row["LoginName"].ToString() == "##MS_AgentSigningCertificate##")<br />
                        dtDbUsers.Rows.Remove(row); // error in this line<br />
                }<br />
                return dtDbUsers;<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                if (con.State == ConnectionState.Open)<br />
                    con.Close();<br />
                this.toolStripStatusLabel1.Text = ex.Message;<br />
                MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
                return null;<br />
            }<br />
            finally<br />
            {<br />
                if (con.State == ConnectionState.Open)<br />
                    con.Close();<br />
            }

my problem is that when i modify the local dataTable object (dtDbUsers) in above method (remove some row), the following error has shown me :
Collection was modified; enumeration operation might not execute.
where does my problem and how to solve it ?
thanks
GeneralRe: Problem to DataTable.Rows.Remove(DataRow row) method. Pin
Dave Kreskowiak11-Jan-08 4:34
mveDave Kreskowiak11-Jan-08 4:34 
GeneralRe: Problem to DataTable.Rows.Remove(DataRow row) method. Pin
hdv21211-Jan-08 5:38
hdv21211-Jan-08 5:38 
GeneralIdentify record in Global Catalog Pin
robot_rock11-Jan-08 3:33
robot_rock11-Jan-08 3:33 
GeneralRe: Identify record in GC Pin
Justin Perez11-Jan-08 4:15
Justin Perez11-Jan-08 4:15 
GeneralRe: Identify record in GC Pin
robot_rock11-Jan-08 4:28
robot_rock11-Jan-08 4:28 
GeneralRe: Identify record in GC Pin
Dave Kreskowiak11-Jan-08 4:30
mveDave Kreskowiak11-Jan-08 4:30 
GeneralRe: Identify record in GC Pin
robot_rock11-Jan-08 4:44
robot_rock11-Jan-08 4:44 
GeneralRe: Identify record in GC Pin
Dave Kreskowiak11-Jan-08 6:20
mveDave Kreskowiak11-Jan-08 6:20 
GeneralRe: Identify record in GC Pin
robot_rock11-Jan-08 6:55
robot_rock11-Jan-08 6:55 
GeneralRe: Identify record in GC Pin
Dave Kreskowiak11-Jan-08 12:24
mveDave Kreskowiak11-Jan-08 12:24 
GeneralRe: Identify record in GC Pin
robot_rock11-Jan-08 12:49
robot_rock11-Jan-08 12:49 
GeneralRe: Identify record in GC Pin
robot_rock11-Jan-08 15:12
robot_rock11-Jan-08 15:12 
QuestionHow to Use C# realize the graphic website map? [modified] Pin
Member 472830111-Jan-08 1:29
Member 472830111-Jan-08 1:29 
AnswerRe: How to realizing the website mapeer? PinPopular
Pete O'Hanlon11-Jan-08 1:36
mvePete O'Hanlon11-Jan-08 1:36 
GeneralRe: How to realizing the website mapeer? Pin
Member 472830111-Jan-08 5:02
Member 472830111-Jan-08 5:02 
GeneralRe: How to realizing the website mapeer? Pin
led mike11-Jan-08 5:03
led mike11-Jan-08 5:03 
GeneralRe: How to realizing the website mapeer? Pin
Member 472830111-Jan-08 5:15
Member 472830111-Jan-08 5:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.