M
Matthew Louden
I want to read how many records in the table, and insert a record with id
field which increment the counter by 1. However, I had the following runtime
on Dim s As Integer = CInt(dr("t")). Since "t" (I want to represent the
count, but just a tempoary variable, not a field in table) doesnt exist in
the table
sqlStmt = "SELECT COUNT(*) As t FROM TimeSlot;"
cmd = New SqlCommand(sqlStmt, conn)
cmd.Connection.Open()
dr = cmd.ExecuteReader
Dim s As Integer = CInt(dr("t")) 'Runtime error: Invalid attempt to read
when no data is present.
any ideas?? please advise!
field which increment the counter by 1. However, I had the following runtime
on Dim s As Integer = CInt(dr("t")). Since "t" (I want to represent the
count, but just a tempoary variable, not a field in table) doesnt exist in
the table
sqlStmt = "SELECT COUNT(*) As t FROM TimeSlot;"
cmd = New SqlCommand(sqlStmt, conn)
cmd.Connection.Open()
dr = cmd.ExecuteReader
Dim s As Integer = CInt(dr("t")) 'Runtime error: Invalid attempt to read
when no data is present.
any ideas?? please advise!