Click here to Skip to main content
15,921,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys, again ive got a problem. as you see ive created a datagrid with a delete button my code in delete botton is as follows
VB
Dim strSQL As String
Dim DBConn As New SqlClient.SqlConnection("Data Source=ML0003135586;Integrated Security=SSPI;" & "Initial Catalog=TestSQL")
Dim DBCmd As SqlClient.SqlCommand
strSQL = "DELETE FROM tblCourses_13514 WHERE Course_Code = '" & data1.DataKeys.Item(e.RowIndex).Value & "'"
DBConn.Open()
DBCmd = New SqlClient.SqlCommand(strSQL, DBConn)
DBCmd.ExecuteNonQuery()
data1.EditIndex = -1
data1.DataBind()
    DBConn.Close()


(actually it run) my problem is it holds on loading and my project pops out and highlighted these
strSQL = "DELETE FROM tblCourses_13514 WHERE Course_Code = '" & data1.DataKeys.Item(e.RowIndex).value &"'" 


Help me plss im new here. thanks and more power
Posted
Updated 3-May-11 16:35pm
v2

1 solution

Not sure what you mean by "project pops out and highlighted these". Did you get an error?
Try debugging your source code to see if you can figure out the exact issue. Check if the value of the data1 item that your are checking is null.
 
Share this answer
 
Comments
janwel 4-May-11 0:23am    
ill try

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900