View Single Post
  #30 (permalink)  
Old July 18th, 2011, 05:59 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
Default

Dim Service_ID As [String]
Service_ID = GridviewOdin.DataKeys(e.RowIndex).Value.ToString()
myconnection.ConnectionString = sqlConStr
mycommand = New SqlCommand("sp_ServiceDel", myconnection)
myconnection.Open()
mycommand.CommandType = CommandType.StoredProcedure
'mycommand.Parameters.Add("@Service_ID", SqlDbType.Int).Value = e.RowIndex
mycommand.Parameters.Add("@Service_ID", SqlDbType.Int, "Service_ID").Value = Convert.ToInt32(Service_ID)

mycommand.ExecuteReader()
myconnection.Close()
Bindgrid()

if i used this way i am gettina a error like"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index "
and even i set a datakeynames in aspx page is gives me and error
what is the method that i can delete the particular selected records