Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2005, 11:22 AM
Registered User
 
Join Date: Dec 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Access Ms-Access WorkGroup tables using VB kishoremf BOOK: Professional Crystal Reports for VS.NET 1 April 29th, 2007 02:05 AM
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
how do i convert ms word doc to access tables??? carswelljr Javascript How-To 1 August 28th, 2006 03:44 AM
left outer join 2 or 3 tables in ms access keyvanjan Classic ASP Basics 2 February 2nd, 2006 06:42 PM
left outer join 2 or 3 tables in ms access keyvanjan SQL Server ASP 0 January 30th, 2006 03:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.