Add to two different tables in MS Access
Hi
Having a problem adding to two different tables that are not related.
My code is:
Sub btnSubmit_Click(Sender As Object, E As EventArgs)
Dim lotto As String = Me.txtlotto1.Text & " " & Me.txtlotto2.Text & " " & Me.txtlotto3.Text & " " & Me.txtlotto4.Text & " " & Me.txtlotto5.Text & " " & Me.txtlotto6.Text
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("ss.mdb") 'c:\Inetpub\wwwroot\staffsurvey\ss.mdb
Dim cmd As New OleDbCommand("INSERT INTO tblss(Sect1Q1,Sect1Q1a,Sect1Q2,Sect1Q2a,Sect1Q3) VALUES ('" & Me.RadioButtonListSect1Q1.SelectedItem.Text & "','" & Me.txtSect1Q1a.Text & "','" & Me.RadioButtonListSect1Q2.SelectedItem.Text & "','" & Me.txtSect1Q2a.Text & "','" & Me.DropDownListSect1Q3.SelectedItem.Text & "')", New OleDbConnection(strConn))
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Sub
This works for just adding into the tblss table.
I have a variable at the top of this called 'lotto'.
How can I use some SQL to add what is inside this variable to another table also called lotto?
Struggling a lot with this.
Thanks for any help.
Think big thoughts, but relish small pleasures
|