Here is my code, I am missing something because. It button click event is not updating the table and not giving me an error.
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim ShoppingCart_ID As String
ShoppingCart_ID = "123ABC"
Dim Confirmation As SqlDataSource = New SqlDataSource
Confirmation.ConnectionString = ConfigurationManager.ConnectionStrings("GARNETConnectionString").ToString()
Dim AdvertisementID As Integer
AdvertisementID = DirectCast(FormView1.FindControl("AdvertisementIDLabel"), Label).Text
Confirmation.UpdateCommand = "UPDATE [Advertisement_TB] SET ([ShoppingCart_ID] = @ShoppingCart_ID) WHERE ([AdvertisementID] = @AdvertisementID)"
Confirmation.UpdateParameters.Add("AdvertisementID", AdvertisementID)
Confirmation.UpdateParameters.Add("ShoppingCart_ID", ShoppingCart_ID)
End Sub
What I have tried:
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim ShoppingCart_ID As String
ShoppingCart_ID = "123ABC"
Dim Confirmation As SqlDataSource = New SqlDataSource
Confirmation.ConnectionString = ConfigurationManager.ConnectionStrings("GARNETConnectionString").ToString()
Dim AdvertisementID As Integer
AdvertisementID = DirectCast(FormView1.FindControl("AdvertisementIDLabel"), Label).Text
Confirmation.UpdateCommand = "UPDATE [Advertisement_TB] SET (ShoppingCart_ID) VALUES (@ShoppingCart_ID) Where [AdvertisementID] = @AdvertisementID"
Confirmation.UpdateParameters.Add("AdvertisementID", AdvertisementID)
Confirmation.UpdateParameters.Add("ShoppingCart_ID", ShoppingCart_ID)
'***
'Label1.Text = ShoppingCart_ID - Tested that the data is passing but no update to the ShoppingCart_ID
'Label2.Text = AdvertisementID - Tested that the data is passing
End Sub