Groups | Blog | Home
all groups > dotnet ado.net > july 2004 >

dotnet ado.net : insert into problem



Stephen
7/31/2004 1:49:35 PM
Hello
I want to insert data from TABLE Master into TABLE tempAr. I have the
following so far. Both tables are in a Access Database
What am i doing wrong?

steve
SQLStatement = "Insert into tempAr(MasterId,Payment)(Select
MasterId,Cust_leasePmt from masterwhere cust_methodofPayment=2)"

SetUpDataBase()

reader = cmd.ExecuteReader()


conn.Close()



Private Sub SetUpDataBase()

On Error Resume Next

conn.Close()

conn.ConnectionString = cs

conn.Open()

cmd.CommandType = CommandType.Text

cmd.Connection = conn

cmd.CommandText = SQLStatement

End Sub

Stephen Martinelli
7/31/2004 6:41:47 PM
just a type

[quoted text, click to view]

William Gower
7/31/2004 9:19:08 PM
Is that just a typo where you don't have a space between master and where?

[quoted text, click to view]

Attila
8/2/2004 4:21:37 AM
Have you tried to take out the parentheses around your select statement? i
don't think access correctly parses them....

hth

attila


[quoted text, click to view]

Paul Clement
8/2/2004 10:10:29 AM
[quoted text, click to view]

¤ Hello
¤ I want to insert data from TABLE Master into TABLE tempAr. I have the
¤ following so far. Both tables are in a Access Database
¤ What am i doing wrong?
¤
¤ steve
¤ SQLStatement = "Insert into tempAr(MasterId,Payment)(Select
¤ MasterId,Cust_leasePmt from masterwhere cust_methodofPayment=2)"
¤

The parenthesis should enclose the column names, not the complete Select statement.

If that does not resolve the problem I would post the error description that is being generated.


Paul ~~~ pclement@ameritech.net
AddThis Social Bookmark Button