Is it possible to increment a pre-existing single cell in an SQL Database with one statement.
Not with two like this example:
cmdStr = "SELECT [col5] FROM [table1] WHERE (id=20),"
connStr = "Connection String works"
Using conn As New SqlConnection(connStr)
conn.Open()
Using cmd As New SqlCommand(cmdStr, conn)
num = cmd.ExecuteScalar().ToString()
End Using
num=num + 1
cmdstr2 = "UPDATE [table1] SET (col5=" & num & ") WHERE (id=20);"
Using cmd As New SqlCommand(cmdStr2, conn)
cmd.ExecuteNonQuery()
End Using
End Using
...
Go to the complete details ...