1
Why dont you use identity column to increment the row number by 1 instead of doing it from Code.
1
An exception of type 'System.InvalidOperationException' occurred in System.Data.dll but was not handled in user code
Additional information: No data exists for the row/column.
not working
I have this code on VB.net but I could not convert it to C
- Dim conn As New SqlConnection("Data Source=xp-pc;Initial Catalog=HR;Integrated Security=True")
- Dim cmd As New SqlCommand("select MAX(LID)+1 from Letters ", conn)
-
- Dim sql As String = "select MAX(LID)+1 from Letters "
-
- conn.Open()
-
- Dim lid As Int32 = Convert.ToInt32(cmd.ExecuteScalar)
- conn.Close()
- TextBox1.Text = lid