Advertisement
Advertisement
| 04.22.2008 at 05:48PM PDT, ID: 23345138 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: |
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
'TextBox1.Text = (Me.ComboBox1.SelectedItem)
Dim sqlconn As New SqlConnection("data source=TBPC25\SQLEXPRESS;Initial Catalog=RealEstate1;Integrated Security=True")
sqlconn.Open()
cmd = New SqlCommand("select firstname from person where firstname='" & ComboBox1.Text & "'", sqlconn)
cmd2 = New SqlCommand("select personid from person where firstname='" & ComboBox1.Text & "'", sqlconn)
cmd3 = New SqlCommand("select personid from legnresp person where personid='" & TextBox3.Text & "'", sqlconn)
'cmd3 = New SqlCommand("select personid from person, legnresp where person.personid = legnresp.personid", sqlconn)
'cmd3 = New SqlCommand("select person.personid from person inner join legnresp on person.personid = legnresp.personid", sqlconn)
'Dim ra As Integer
dr = cmd.ExecuteReader()
If dr.read Then
TextBox1.Text = Trim(dr(0))
End If
sqlconn.Close()
sqlconn.Open()
dr2 = cmd2.ExecuteReader
If dr2.Read Then
TextBox3.Text = Trim(dr2(0))
End If
sqlconn.Close()
' If dr3.Read Then
'TextBox4.Text = Trim(dr3(0))
' End If
sqlconn.Open()
TextBox4.Text = cmd3.ExecuteNonQuery()
sqlconn.Close()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim sqlconn As New SqlConnection("data source=TBPC25\SQLEXPRESS;Initial Catalog=RealEstate1;Integrated Security=True")
sqlconn.Open()
Dim command As String
'Dim command2 As String
command = "delete from person where personid = '" & TextBox3.Text & " ' "
' command2 = "delete from legnresp where personid = '" & TextBox3.Text & " ' "
'and person.personid=legnresp.personid"
Dim dbcommand As SqlCommand = New SqlCommand(command, sqlconn)
dbcommand.ExecuteNonQuery()
MessageBox.Show("records have been deleted")
sqlconn.Close()
|