My goal:
- Create a bank balance system with balance break per day
Actual Results:
- I can extract the data what I want from my database, sum balance, and fill the datagrid with it
what I need:
- I need a break in the transition of each day, which will tell me the balance of the day...
The problem:
I get an error if I try to input a string "Saldo" in "Valor" (decimal) column, which contains all values
I tried to change "DataType" of column "Valor", but it says I can't change datatype of a filled column.
Code
Dim dt As New DataTable()
Using adapter As New SqlDataAdapter("SELECT * FROM TAB_Movimentos
WHERE Banco = @Banco
ORDER BY Data ASC, Ordem ASC, Valor DESC, Histórico ASC", New SqlConnection(MontaStringConexaoSQLServer()))
adapter.SelectCommand.Parameters.Add("@Banco", SqlDbType.Int).Value = cbBanco.Value
adapter.Fill(dt)
End Using
tabHistorico.DataSource = dt.DefaultView
linhasaldo as integer = 5
Dim nlinha As DataRow = dt.NewRow
nlinha("Valor") = "Saldo: "
nlinha("Saldo") = saldo
dt.Rows.InsertAt(nlinha, linhasaldo)
This's what I want, It need some formatting in values, I reached this changing my SQL "Valor" column data type to varchar
This's what I've in the moment, this's the "tabhistorico" datagrid
This's my database