Dear All

I am using Vb.net to update a database running on SQL Server.

I am using the following to increase the value of the NextPlan in the SystemControl table in a SQL database.

Command.CommandText = "UPDATE SystemControl SET NextPlan = NextPlan + 1"
Command.ExecuteNonQuery()

Once the Command is executed and I look in the actual database I can see the value has been incremented. How can I get the Command to return the new value of NextPlan so I don't need to then do a table read to get the new value.

Thanks

Re: VB.NET get Return Values from SQL UPDATE 80 80

Try the following

Dim id as Integer = Command.ExecuteScalar()
Re: VB.NET get Return Values from SQL UPDATE 80 80

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.