Edit the data in a detail view at run time
-
Hi, I am binding a data in a detail view at run time. But I also want to edit it at the run time. I have tried the following code. Protected Sub Detailsview1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles Detailsview1.ItemUpdating Dim index As Integer = Generic_DG.SelectedIndex Dim con As New SqlConnection(ConfigurationManager.AppSettings("connectionString")) Dim cmd As New SqlCommand() cmd.CommandText = "UPDATE Products SET ProdName=@ProdName where ProdId=@ProdId" cmd.Connection = con cmd.Connection.Open() cmd.ExecuteNonQuery() cmd.Connection.Close() End Sub How can I replace @ProdName with data in a detail view? OR Which property of the detailview I have to use for it?
Rock Star
-
Hi, I am binding a data in a detail view at run time. But I also want to edit it at the run time. I have tried the following code. Protected Sub Detailsview1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles Detailsview1.ItemUpdating Dim index As Integer = Generic_DG.SelectedIndex Dim con As New SqlConnection(ConfigurationManager.AppSettings("connectionString")) Dim cmd As New SqlCommand() cmd.CommandText = "UPDATE Products SET ProdName=@ProdName where ProdId=@ProdId" cmd.Connection = con cmd.Connection.Open() cmd.ExecuteNonQuery() cmd.Connection.Close() End Sub How can I replace @ProdName with data in a detail view? OR Which property of the detailview I have to use for it?
Rock Star
hi I see what you are trying to do , but your question says something else, now from what i see from your code, you have parameters that are not declared.
Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za