views:

105

answers:

1

How to Create a Table from the recordset value

sqlCardEvent1 = "select * from tmp_CARDEVENT"
    If rsCardEvent1.State = 1 Then rsCardEvent1.Close
    rsCardEvent1.Open sqlCardEvent1, Cn, adOpenStatic, adLockOptimistic
    cmdCardEvent1.CommandText = sqlCardEvent1
    Set rsCardEvent1 = cmdCardEvent1.Execute

    sql33 = "create table tmp_date1 from"  & rsCardEvent1 
    rstmpDATE1.Open sql33, Cn, adOpenStatic, adLockOptimistic

Need SQL Query Help?

+1  A: 

You would do it in SQL and use the ExecuteNonQuery method of SqlCommand:

sqlCardEvent = "select * " & _
    "into tmp_date1 " & _
    "from tmp_CARDEVENT"
cmdCardEvent1.CommandText = sqlCardEvent
cmdCardEvent.ExecuteNonQuery
Eric
NO, You are creating a table from the other table. But i want create a table from the recordset. In recordset already i have table value
@Jash: I'm confused...why do you want to create it from the recordset and not just in SQL? The SQL method is much more efficient. You aren't editing the recordset, are you? What do you gain out of doing this through a layer of abstraction?
Eric