Click here to Skip to main content
15,885,876 members
Home / Discussions / C#
   

C#

 
GeneralRe: Update in C# using SQL Server Database. Pin
Agent__00710-May-15 22:12
professionalAgent__00710-May-15 22:12 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell11-May-15 5:49
Norris Chappell11-May-15 5:49 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell11-May-15 6:54
Norris Chappell11-May-15 6:54 
GeneralRe: Update in C# using SQL Server Database. Pin
Mycroft Holmes11-May-15 14:43
professionalMycroft Holmes11-May-15 14:43 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell11-May-15 15:22
Norris Chappell11-May-15 15:22 
GeneralRe: Update in C# using SQL Server Database. Pin
Mycroft Holmes11-May-15 16:09
professionalMycroft Holmes11-May-15 16:09 
AnswerRe: Update in C# using SQL Server Database. Pin
Agent__00711-May-15 17:20
professionalAgent__00711-May-15 17:20 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell11-May-15 20:09
Norris Chappell11-May-15 20:09 
Hi, I don't have any of my fields with a label. I'm still getting an Out of Range error.
C#
protected void Button_Update(object sender, EventArgs e)
      {
          using (SqlCommand cmd = new SqlCommand())
          {

              // SqlDataReader myReader = null;
              // myReader = cmd.ExecuteReader();
              foreach (GridViewRow row in gvKeyPersonnel.Rows)
              {

                  cmd.Connection = conn;
                  conn.Open();

                  cmd.CommandText = "UPDATE SP2010_EDCStaffing_AppDB.dbo.CMS_Key_Personnel  SET  Name = @Name, VDCIDIQ = @VDCIDIQ, VDCFFS = @VDCFFS, VDCHIM = @VDCHIM, VDCWEBHOSTING = @VDCWEBHOSTING, VDCCWF = @VDCCWF WHERE ID = @id";

                  cmd.Parameters.AddWithValue("@id", Convert.ToInt32(gvKeyPersonnel.DataKeys[row.RowIndex].Values[0]));
                  cmd.Parameters.AddWithValue("@Name", row.Cells[1].Text);
                  cmd.Parameters.AddWithValue("@VDCIDIQ", row.Cells[2].Text);
                  cmd.Parameters.AddWithValue("@VDCFFS", row.Cells[3].Text);
                  cmd.Parameters.AddWithValue("@VDCHIM", row.Cells[4].Text);
                  cmd.Parameters.AddWithValue("@VDCWEBHOSTING", row.Cells[5].Text);
                  cmd.Parameters.AddWithValue("@VDCCWF", row.Cells[6].Text);
                  cmd.ExecuteNonQuery();
              }
              conn.Close();
          }
      }

GeneralRe: Update in C# using SQL Server Database. Pin
Agent__00711-May-15 20:30
professionalAgent__00711-May-15 20:30 
GeneralRe: Update in C# using SQL Server Database. Pin
Mycroft Holmes11-May-15 22:32
professionalMycroft Holmes11-May-15 22:32 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon12-May-15 0:26
mvePete O'Hanlon12-May-15 0:26 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell12-May-15 4:27
Norris Chappell12-May-15 4:27 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon12-May-15 4:49
mvePete O'Hanlon12-May-15 4:49 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell12-May-15 11:36
Norris Chappell12-May-15 11:36 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell12-May-15 11:55
Norris Chappell12-May-15 11:55 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon12-May-15 13:45
mvePete O'Hanlon12-May-15 13:45 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell12-May-15 13:51
Norris Chappell12-May-15 13:51 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon12-May-15 19:57
mvePete O'Hanlon12-May-15 19:57 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell12-May-15 20:02
Norris Chappell12-May-15 20:02 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon12-May-15 21:00
mvePete O'Hanlon12-May-15 21:00 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell12-May-15 21:55
Norris Chappell12-May-15 21:55 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon12-May-15 22:17
mvePete O'Hanlon12-May-15 22:17 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell13-May-15 3:48
Norris Chappell13-May-15 3:48 
GeneralRe: Update in C# using SQL Server Database. Pin
Pete O'Hanlon13-May-15 4:11
mvePete O'Hanlon13-May-15 4:11 
GeneralRe: Update in C# using SQL Server Database. Pin
Norris Chappell13-May-15 5:17
Norris Chappell13-May-15 5:17 

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.