I'm working on commercial app that deals with invoices, so every invoices has to increase its/own number regard to number of rows within MS Access DB and put the value to the TextBox6 .... i tried this below but it only counts one row within DB and i always start with No. 2 in the field invoice No. no matter i have even thousends of rows //how it could be ... i'm very confused
? ?Private Sub Faktura_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
? ? ? ?oledbcon.Open()
? ? ? ?Dim sqlNew As New OleDbCommand("SELECT IDNum FROM Fakturi", oledbcon)
? ? ? ?sqlNew.ExecuteNonQuery()
? ? ? ?Try
? ? ? ? ? ?da.Fill(ds, "Table1")
? ? ? ?Catch ex As Exception
? ? ? ? ? ?MessageBox.Show(ex.Message)
? ? ? ?End Try
? ? ? ?TextBox6.Text = Val(ds.Tables("Table1").Rows.Count.ToString + 1)
? ? ? ?oledbcon.Close()
? ?End Sub
Question
Southern Man
Hi,
I'm working on commercial app that deals with invoices, so every invoices has to increase its/own number regard to number of rows within MS Access DB and put the value to the TextBox6 .... i tried this below but it only counts one row within DB and i always start with No. 2 in the field invoice No. no matter i have even thousends of rows //how it could be ... i'm very confused
? ?Private Sub Faktura_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter ? ? ? ?oledbcon.Open() ? ? ? ?Dim sqlNew As New OleDbCommand("SELECT IDNum FROM Fakturi", oledbcon) ? ? ? ?sqlNew.ExecuteNonQuery() ? ? ? ?Try ? ? ? ? ? ?da.Fill(ds, "Table1") ? ? ? ?Catch ex As Exception ? ? ? ? ? ?MessageBox.Show(ex.Message) ? ? ? ?End Try ? ? ? ?TextBox6.Text = Val(ds.Tables("Table1").Rows.Count.ToString + 1) ? ? ? ?oledbcon.Close() ? ?End SubThanks in advance
Link to comment
Share on other sites
9 answers to this question
Recommended Posts