0
I need to take an input time and an output two textboxs, store in the bank and later display, my code is like this:
//Cadastro
//No evento do botão cadastrar
entradaSaida.HrEntrada = Convert.ToDateTime(txtHrEntrada.Text);
entradaSaida.HrSaida = Convert.ToDateTime(txtHrSaida.Text);
//No método insert do banco
cmd.Parameters.AddWithValue("@hrentrada", entradaSaida.HrEntrada);
cmd.Parameters.AddWithValue("@hrsaida", entradaSaida.HrSaida);
//Pegando do banco
entradaSaida.HrEntrada = (DateTime)dr["hrentrada"];
entradaSaida.HrSaida = (DateTime)dr["hrsaida"];
//Exibindo no ListView
materialListView1.Items.Add(new ListViewItem(new string[] {item.HrEntrada.ToShortTimeString(), item.HrSaida.ToShortTimeString()}));
When I store, what comes from the textbox is something like "13:00", but when it comes to displaying in Listview all times are reset "00:00". If anyone can help me, I’d appreciate it
Only 13:00 is stored in txtHrEntrada.Text? or a full date with time?
– George Wurthmann
Another thing, where did the "item" of your Listview come from? It is missing some piece of your code I think. Post the whole thing so we can help you.
– George Wurthmann
txtBox is only stored "13:00" anyway. About the Item, this code is from a foreach in the list, so I only got the part that adds the same item
– Raphael Villadouro
Dear Rafael you are recording as, you do as CRUD operations?
– novic