insert into problem

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

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
 
Have you tried to take out the parentheses around your select statement? i
don't think access correctly parses them....

hth

attila
 
¤ 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 ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top