Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Memory performance and foreach vs for Pin
Super Lloyd15-Jun-14 5:07
Super Lloyd15-Jun-14 5:07 
AnswerRe: Memory performance and foreach vs for Pin
V.15-Jun-14 21:07
professionalV.15-Jun-14 21:07 
GeneralRe: Memory performance and foreach vs for Pin
Super Lloyd15-Jun-14 22:42
Super Lloyd15-Jun-14 22:42 
GeneralRe: Memory performance and foreach vs for Pin
V.15-Jun-14 22:49
professionalV.15-Jun-14 22:49 
AnswerRe: Memory performance and foreach vs for Pin
BobJanova16-Jun-14 0:39
BobJanova16-Jun-14 0:39 
AnswerRe: Memory performance and foreach vs for Pin
jschell17-Jun-14 8:53
jschell17-Jun-14 8:53 
GeneralRe: Memory performance and foreach vs for Pin
LostTheMarbles17-Jun-14 23:35
professionalLostTheMarbles17-Jun-14 23:35 
Questionproblem using for() with datagrid - blank cell value Pin
Jassim Rahma14-Jun-14 0:03
Jassim Rahma14-Jun-14 0:03 
Hi,

I am using the following for() to loop through a datagrid to save to a database. My problem here is: when looping, I am getting all records correct except the last record which I am getting a blank cell value for it. what's wrong with my for() please?

C#
for (int i = 0; i <= gridContacts.RowCount; i++)
{
    sql_command = new MySqlCommand("sp_add_new_employee_contact", sql_connection);
    sql_command.CommandType = CommandType.StoredProcedure;
    sql_command.CommandTimeout = Convert.ToInt32(string_encryptor.DecryptString(xmlClass.read_xml_value("HRMS\\HRMS", "CommandTimeOut"), "JassimRahma@731004167"));

    sql_command.Parameters.AddWithValue("param_employee_id", employee_id).MySqlDbType = MySqlDbType.Int32;
    sql_command.Parameters.AddWithValue("param_contact_category", Convert.ToInt32(gridContacts.GetRowCellValue(i, "contact_category"))).MySqlDbType = MySqlDbType.Int32;
    sql_command.Parameters.AddWithValue("param_contact_details", Convert.ToString(gridContacts.GetRowCellValue(i, "contact_details"))).MySqlDbType = MySqlDbType.VarChar;
    sql_command.Parameters.AddWithValue("param_contact_description", Convert.ToString(gridContacts.GetRowCellValue(i, "contact_description"))).MySqlDbType = MySqlDbType.VarChar;

    MessageBox.Show(Convert.ToString(gridContacts.GetRowCellValue(i, "contact_details")));

    int result_rows = sql_command.ExecuteNonQuery();
}



Thanks,
Jassim


Technology News @ www.JassimRahma.com

AnswerRe: problem using for() with datagrid - blank cell value Pin
Estys14-Jun-14 1:24
Estys14-Jun-14 1:24 
AnswerRe: problem using for() with datagrid - blank cell value Pin
Dave Kreskowiak14-Jun-14 5:07
mveDave Kreskowiak14-Jun-14 5:07 
GeneralRe: problem using for() with datagrid - blank cell value Pin
PIEBALDconsult14-Jun-14 18:49
mvePIEBALDconsult14-Jun-14 18:49 
GeneralRe: problem using for() with datagrid - blank cell value Pin
PIEBALDconsult14-Jun-14 18:57
mvePIEBALDconsult14-Jun-14 18:57 
AnswerRe: problem using for() with datagrid - blank cell value Pin
Shrutik Panchal15-Jun-14 12:49
professionalShrutik Panchal15-Jun-14 12:49 
AnswerRe: problem using for() with datagrid - blank cell value Pin
Swinkaran15-Jun-14 14:10
professionalSwinkaran15-Jun-14 14:10 
AnswerRe: problem using for() with datagrid - blank cell value Pin
AshishvermaMCA15-Jun-14 20:07
AshishvermaMCA15-Jun-14 20:07 
AnswerRe: problem using for() with datagrid - blank cell value Pin
V.15-Jun-14 21:11
professionalV.15-Jun-14 21:11 
Questionhow to expire cookies best way in my project Pin
Nishant.Chauhan8013-Jun-14 20:28
Nishant.Chauhan8013-Jun-14 20:28 
AnswerRe: how to expire cookies best way in my project Pin
Mycroft Holmes13-Jun-14 21:02
professionalMycroft Holmes13-Jun-14 21:02 
AnswerRe: how to expire cookies best way in my project Pin
PIEBALDconsult13-Jun-14 21:09
mvePIEBALDconsult13-Jun-14 21:09 
QuestionSharpGL: how to add a solid object to a scene Pin
Member 1075894613-Jun-14 10:02
Member 1075894613-Jun-14 10:02 
Questionnew C# forum Pin
Shady George13-Jun-14 9:29
Shady George13-Jun-14 9:29 
AnswerRe: new C# forum Pin
Dave Kreskowiak13-Jun-14 12:40
mveDave Kreskowiak13-Jun-14 12:40 
GeneralRe: new C# forum Pin
Shady George13-Jun-14 17:21
Shady George13-Jun-14 17:21 
GeneralRe: new C# forum Pin
OriginalGriff13-Jun-14 18:38
mveOriginalGriff13-Jun-14 18:38 
AnswerRe: new C# forum Pin
Mycroft Holmes13-Jun-14 13:17
professionalMycroft Holmes13-Jun-14 13: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.