ranu jain -7 Light Poster

handles clouse require a withevent variable defined in containing type or one of its base type


i got this error in the following code

Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub submit2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit2.Click
Dim i As Integer, j As Integer, k As Integer
'Dim conn As New SqlConnection
Dim conn1 As New SqlConnection
'Dim cmd As SqlCommand
Dim cmd1 As SqlCommand
'Dim dp As New SqlDataAdapter
Dim dp1 As New SqlDataAdapter
'Dim ds As New DataSet
Dim ds1 As New DataSet
Dim str1 As String
'Dim str As String = "select * from Students_Main_DB"
'conn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
'conn.Open()
'cmd = New SqlCommand()
'cmd.CommandType = CommandType.Text
'cmd.CommandText = str
'cmd.Connection = conn
'cmd.ExecuteNonQuery()
'dp = New SqlDataAdapter(cmd)
'dp.SelectCommand = cmd
'dp.Fill(ds)
'flag1 = 0
With ds1.Tables(0)
For i = 0 To .Rows.Count - 1
'If ((SC_id.Text.Trim).ToUpper() = .Rows(i).Item("S_id").ToString()) Then
'If ((F_name.Text.Trim).ToUpper() = .Rows(i).Item("F_name").ToString()) Then
'If ((M_name.Text.Trim).ToUpper() = .Rows(i).Item("M_name").ToString()) Then
'If ((L_name.Text.Trim).ToUpper() = .Rows(i).Item("L_name").ToString()) Then
'If ((Father.Text.Trim).ToUpper() = .Rows(i).Item("Fathers_name").ToString()) Then
'If ((Mother.Text.Trim).ToUpper() = .Rows(i).Item("Mothers_name").ToString()) Then
'flag1 = 1
' On Error GoTo Handler
str1 = "Insert into Join( First_Name, Email_Id,Password) Values('" & ((User_Name.Input).Trim).ToUpper() & " ' , '" & ((Your_Mail_Id.Text).Trim).ToUpper() & "' ,'" & Password.Text & "')"
conn1 = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
conn1.Open()
cmd1 = New SqlCommand()
cmd1.CommandType = CommandType.Text
cmd1.CommandText = str1
cmd1.Connection = conn1
j = cmd1.ExecuteNonQuery()
'Session("id") = .Rows(i).Item("S_id").ToString()
'Exit For
'End If
'End If
'End If
'End If
'End If
'End If
Next
End With
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub
End Class

plz reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.