View Single Post
  #21 (permalink)  
Old July 14th, 2011, 07:46 AM
priti2010 priti2010 is offline
Authorized User
Points: 63, Level: 1
Points: 63, Level: 1 Points: 63, Level: 1 Points: 63, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Red face

Protected Sub DataGridOdin_RowDeleting1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles DataGridOdin.RowDeleting


Try
myconnection.ConnectionString = sqlConStr
If myconnection.State <> ConnectionState.Open Then myconnection.Open()
Dim mycommand As SqlCommand
mycommand = New SqlCommand("sp_ServiceDel", myconnection)
mycommand.CommandType = CommandType.StoredProcedure
mycommand.Parameters.Add("@Service_ID", SqlDbType.Int).Value = e.RowIndex

MsgBox("Do you want to Delete", MsgBoxStyle.OkCancel, "Confirmation")
If (MsgBoxResult.Ok) Then

Dim a As Integer
a = mycommand.ExecuteNonQuery
MsgBox("Record Deleted")
myconnection.Close()
Bindgrid()
End If

Catch ex As Exception
Response.Write(ex.Message)
End Try

End Sub

Protected Sub DataGridOdin_RowUpdating1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles DataGridOdin.RowUpdating
Try
Dim mycommand As SqlCommand
myconnection.ConnectionString = sqlConStr
'If myconnection.State <> ConnectionState.Open Then myconnection.Open()
mycommand = New SqlCommand("sp_ServiceUpdt", myconnection)
mycommand.CommandType = CommandType.StoredProcedure
mycommand.Parameters.Add("@Service_ID", SqlDbType.Int).Value = e.RowIndex
mycommand.Parameters.Add("@Service_Name", SqlDbType.NChar, 100).Value = txtServiceName.Text.Trim
mycommand.Parameters.Add("@NSE", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@BSE", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@NSE_FO", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@MCX", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@MCX_SX", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@NCDEX", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@NSE_SX", SqlDbType.Bit).Value = chkExchange.Text
mycommand.Parameters.Add("@Manager_1", SqlDbType.Bit).Value = chkServer.Text
mycommand.Parameters.Add("@Manager_2", SqlDbType.Bit).Value = chkServer.Text
mycommand.Parameters.Add("@MIS_101", SqlDbType.Bit).Value = chkServer.Text
mycommand.Parameters.Add("@MIS_102", SqlDbType.Bit).Value = chkServer.Text
mycommand.Connection = myconnection
MsgBox("Do you want to Update", MsgBoxStyle.OkCancel, "Confirmation")
If (MsgBoxResult.Ok) Then
MsgBox("Record Updated")
DataGridOdin.EditIndex = -1
Bindgrid()
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try

End Sub


This is my code, i m not getting any errors while debugging this code
only the records are not deleting proper and the update its wont update the gridview