I am trying to create a temporary table through code in my DB.  I can do
it when I use MySQL Control Center or something like that, but when I
try to do it through my VB program it doesn't work.  
 
Here is the sql string:
 
CREATE TEMPORARY TABLE IndenturedList (Level_1 TEXT, Level_2 TEXT,
AssemblyNumber TEXT, NSIPartNumber TEXT, RecordID INT NOT NULL
AUTO_INCREMENT, PRIMARY KEY (RecordID));
 
If I paste this into MySQL Control Center I have no problem creating
it.  Here is the code from my VB program:
 
    Dim cn As New ADODB.Connection
    Dim RS As New ADODB.Recordset
    Dim fld As ADODB.Field
    Dim DataArray() As String
    Dim i As Long
    Dim lngRecordAffected As Long

    Set cn = New ADODB.Connection
   strSQL = "CREATE TEMPORARY TABLE IndenturedList (Level_1 TEXT,
Level_2 TEXT, AssemblyNumber TEXT, NSIPartNumber TEXT, RecordID INT NOT
NULL AUTO_INCREMENT, PRIMARY KEY (RecordID));"
            
    cn.Open "Driver={MySQL ODBC 3.51 Driver}; Server=" & gStrSQLServer
& ";database=NSITbls; uid=" & gStrCurrentUser & "; Password=" &
gStrCurrentUser & ";"
    
    cn.Execute strSQL, lngRecordAffected
 
Nothing happens when I run this code.  Is the SQL string only for a DAO
connection?  The reason I ask is because when I need to write data to
the db I just change the SQL string and it works.
 
Does anyone know what is wrong?
 
Thank you,
 
Jacque

Reply via email to