Click here to Skip to main content
15,914,905 members
Home / Discussions / C#
   

C#

 
Questionguidance on supplying credentials to the server via sockets for login to the server Pin
Arjun Mourya27-Nov-13 1:56
Arjun Mourya27-Nov-13 1:56 
AnswerRe: guidance on supplying credentials to the server via sockets for login to the server Pin
Nicholas Marty27-Nov-13 3:59
professionalNicholas Marty27-Nov-13 3:59 
AnswerRe: guidance on supplying credentials to the server via sockets for login to the server Pin
Dave Kreskowiak27-Nov-13 5:11
mveDave Kreskowiak27-Nov-13 5:11 
AnswerRe: guidance on supplying credentials to the server via sockets for login to the server Pin
Eddy Vluggen27-Nov-13 7:11
professionalEddy Vluggen27-Nov-13 7:11 
Questionc# listview Pin
Member 1026351927-Nov-13 1:46
Member 1026351927-Nov-13 1:46 
GeneralRe: c# listview Pin
harold aptroot27-Nov-13 4:54
harold aptroot27-Nov-13 4:54 
AnswerRe: c# listview Pin
Eddy Vluggen27-Nov-13 7:20
professionalEddy Vluggen27-Nov-13 7:20 
GeneralRe: c# listview Pin
Member 1026351927-Nov-13 19:11
Member 1026351927-Nov-13 19:11 
it's ok. thanq

But am getting error as ArgumentOutORange exception at
item.SubItems[INTime.Index].Text = s2;

Listview consists 0nly 7 colums.


string query = "SELECT tag_id,category_id,product_id,product_name,gate_id,remarks FROM inventory where tag_id Like '" + sEPC + "'";
                      MySqlCommand cmd;
                      MySqlDataReader rdr;
                      MySqlConnection connection = new MySqlConnection(MyConnectionString);
                      connection.Open();

                     // DataTable dt = new DataTable();
                      cmd = new MySqlCommand(query, connection);
                      rdr = cmd.ExecuteReader();
                      /*Received Epc matched in the Inventory Table */
                      if (rdr != null)
                      {
                          String s2 = DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss").Trim();
                          //      ListView1_EPC.Items[j].Remove();
                          if (rdr.Read())
                          {


                              cnt = ListView1_EPC.Items.Count;
                              ListViewItem item = new ListViewItem(rdr.GetString(0));
                              cnt = ListView1_EPC.Items.Count;

                              item.SubItems.Add(rdr.GetString(1));
                              item.SubItems.Add(rdr.GetString(2));
                              item.SubItems.Add(rdr.GetString(3));
                              item.SubItems.Add(rdr.GetString(4));
                             // item.SubItems.Add(s2);
                             // item.SubItems.Add(s2);
                              //item.SubItems[OUTTime.Index].Text = rdr.GetString(5);
                              item.SubItems.Add(rdr.GetString(5));
                              ListView1_EPC.Items.Add(item);
                              cnt = ListView1_EPC.Items.Count;
                              rdr.Close();
                              string query1 = "SELECT tag_id,category_id,product_id,product_name,gate_id,remarks FROM transaction where tag_id Like '" + sEPC + "' AND out_time=NULL";
                              MySqlCommand cmd1= new MySqlCommand(query1,connection);
                              MySqlDataReader rdr1 = cmd1.ExecuteReader();
                              if (rdr1 != null)
                              {
                                  item.SubItems[INTime.Index].Text = s2;
                                  ListView1_EPC.Items.Add(item);

                                  String s1 = "update transaction set out_time='" + s2 + "'  where tag_id='" + ListView1_EPC.Items[i].Text + "' ";
                                  MySqlCommand cmd2 = new MySqlCommand(s1, connection);
                                  cmd2.ExecuteNonQuery();

                              }
                              else
                              {
                                  item.SubItems[Remarks.Index].Text = s2;
                                  ListView1_EPC.Items.Add(item);

                                  String str = "insert into transaction(tag_id,category_id,product_id,product_name,gate_id,in_time,remarks)values('" + ListView1_EPC.Items[i].Text.Trim() + "','" + item.SubItems[CategoryID.Index].Text.Trim() + "','" + item.SubItems[ProductID.Index].Text.Trim() + "','" + item.SubItems[ProductName.Index].Text.Trim() + "','" + item.SubItems[GateID.Index].Text.Trim() + "','" + item.SubItems[Remarks.Index].Text.Trim() + "','" + item.SubItems[OUTTime.Index].Text.Trim() + "')";
                                  MySqlCommand cmd2 = new MySqlCommand(str, connection);
                                  cmd2.ExecuteNonQuery();
                              }



                          }//if

GeneralRe: c# listview Pin
Eddy Vluggen28-Nov-13 9:35
professionalEddy Vluggen28-Nov-13 9:35 
QuestionC# code to relate two nodes Pin
AshwiniSH26-Nov-13 19:33
professionalAshwiniSH26-Nov-13 19:33 
AnswerRe: C# code to relate two nodes Pin
Bernhard Hiller26-Nov-13 21:11
Bernhard Hiller26-Nov-13 21:11 
GeneralRe: C# code to relate two nodes Pin
AshwiniSH26-Nov-13 21:59
professionalAshwiniSH26-Nov-13 21:59 
AnswerRe: C# code to relate two nodes Pin
OriginalGriff26-Nov-13 23:13
mveOriginalGriff26-Nov-13 23:13 
AnswerRe: C# code to relate two nodes Pin
Richard MacCutchan27-Nov-13 0:28
mveRichard MacCutchan27-Nov-13 0:28 
QuestionMatrices and moving objects in Unity3D c# Pin
begginerc226-Nov-13 3:57
begginerc226-Nov-13 3:57 
SuggestionRe: Matrices and moving objects in Unity3D c# Pin
Richard MacCutchan26-Nov-13 5:54
mveRichard MacCutchan26-Nov-13 5:54 
QuestionGetting a value from one method to another method Pin
Member 982953626-Nov-13 2:16
Member 982953626-Nov-13 2:16 
AnswerRe: Getting a value from one method to another method Pin
OriginalGriff26-Nov-13 2:36
mveOriginalGriff26-Nov-13 2:36 
GeneralRe: Getting a value from one method to another method Pin
Member 982953626-Nov-13 3:17
Member 982953626-Nov-13 3:17 
GeneralRe: Getting a value from one method to another method Pin
GuyThiebaut26-Nov-13 3:48
professionalGuyThiebaut26-Nov-13 3:48 
GeneralRe: Getting a value from one method to another method Pin
OriginalGriff26-Nov-13 3:52
mveOriginalGriff26-Nov-13 3:52 
AnswerRe: Getting a value from one method to another method Pin
Richard MacCutchan26-Nov-13 2:46
mveRichard MacCutchan26-Nov-13 2:46 
QuestionNeed Decrypt Code Pin
Pradeep Dwivedi26-Nov-13 1:09
Pradeep Dwivedi26-Nov-13 1:09 
AnswerRe: Need Decrypt Code Pin
Dave Kreskowiak26-Nov-13 1:31
mveDave Kreskowiak26-Nov-13 1:31 
AnswerRe: Need Decrypt Code Pin
Manfred Rudolf Bihy26-Nov-13 2:05
professionalManfred Rudolf Bihy26-Nov-13 2:05 

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.