I am trying to insert a value numeric + 1 in to db table but i get error when i do this
this is the code
Const SQLAsString ="INSERT INTO [PageHits] ([DefaultPage]) VALUES (@.defaultP)"
Dim myCommandAsNew Data.SqlClient.SqlCommand(SQL, myConnection)myCommand.Parameters.AddWithValue("@.DefaultP" +"1", DefaultP.Text.Trim())myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
The Error:
Must declare the variable '@.defaultP'.
Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: Must declare the variable '@.defaultP'.
The code you wrote will send a parameter called @.DefaultP1 to the database.
Did you want to increase an existing value in the database? If so, you must use an UPDATE query.sql
No comments:
Post a Comment