Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

ExecuteScalar is inserting but does not return any value

$
0
0
Hi

Title is auto descriptive so here is the code:


Where Query = Insert Into Table (Col1, Col2 etc...) Values (Val1, Val2 etc...)


Private Function Insert(ByVal Query As String) As Integer

SQLCommand.CommandText = Query

Connection.Open()

Dim ID As Integer
ID = SQLCommand.ExecuteScalar()

Connection.Close()

Return ID

End Function


It's inserting the row into the table but the ID variable always shows 0

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>