Execute SQL Statement??? 
Author Message
 Execute SQL Statement???

I am using SQL 7 and VB 6 with ADO connections.
I need to execute an SQL statement without having it associated to an object
like a grid or recordset.  When I click a button, I need to execute a INSERT
INTO statement.  I have written and confirmed the SQL statements, now I just
need to execute it.  Basically execute a standalone SQL statement.  Any
info. would be appreciated.
Thanks,
Brock




Sun, 12 Aug 2001 03:00:00 GMT  
 Execute SQL Statement???
You can use the Execute method of the ADO connection or command object:

Dim adcDB As ADODB.Connection
Dim strSQL As String
Dim lngAffected As Long

    Set adcDB = New ADODB.Connection

    With adcDB
        .ConnectionString = <connection string>
        .Open
    End With

strSQL = "INSERT INTO Temp SELECT * FROM Current"
adcDB.Execute strSQL, lngAffected, adCmdText + adExecuteNoRecords

Quote:

>I am using SQL 7 and VB 6 with ADO connections.
>I need to execute an SQL statement without having it associated to an
object
>like a grid or recordset.  When I click a button, I need to execute a
INSERT
>INTO statement.  I have written and confirmed the SQL statements, now I
just
>need to execute it.  Basically execute a standalone SQL statement.  Any
>info. would be appreciated.
>Thanks,
>Brock





Sun, 12 Aug 2001 03:00:00 GMT  
 Execute SQL Statement???
Thanks Larry,
It works great.  I needed a little memory jog.
Brock


Mon, 13 Aug 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. errors different when executing SQL statements via recordset or connection object

2. how to execute SQL statements

3. Problems Executing SQL Statements

4. Execute SQL Statement???

5. Execute SQL statements in a MySQL database through ADODB.Connectio

6. Help - Executing SQL statements within VB

7. Write One SQL statement execute in Oracle and SQL Server

8. Can't execute a user define function in an SQL statement

9. Executing a v.long SQL script with multiple go statements

10. How to execute a long SQL statement?

11. Executing UPDATE SQL statements in DAO 3.5 and VB5

12. SQL statement error (Problem when more than once execute)

 

 
Powered by phpBB® Forum Software