
June 30th, 2008, 01:55 PM
|
|
Contributing User
|
|
Join Date: May 2008
Posts: 48
Time spent in forums: 10 h 42 m 50 sec
Reputation Power: 1
|
|
|
ASP.Net/VB.Net - Run an Append Query
Does anyone know how I would go about running an append query from a .Net page to an Access database? I know the basic syntax for writing to a table would be like this.
Code:
Dim sqlString As String = "INSERT INTO Temp (WORLD_SEGMENT) VALUE (" & lstWS.SelectedItem.ToString() & ")"
Dim sqlString As String = "INSERT INTO Temp (Test1,Test2) VALUES (?,?)"
Using con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("OppRptBE1.mdb") & ";")
Using cmd As New OleDbCommand(sqlString, con)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("Test1", txtFirstName.Text)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("Test2", txtLastName.Text)
con.Open()
cmd.ExecuteNonQuery()
End Using
End Using
What I need to do is something like this
Code:
INSERT INTO TheValues ( Test1 )
SELECT Temp.Test1
FROM Temp
WHERE (((Temp.Test1)= strSelections));
strSelections contains values that were captured based on selections made in a List Box. Any help would be appreciated.
|