Solved
problems with Query INSERT IN
Posted on 2004-09-14
Guys,
I need to take the data from a SQL Server 2000 Database to a Access Database. To accomplish this task, first I tryed to do from a Access database to another access database, so I wrote the code below:
Dim Conn As New OleDb.OleDbConnection(StringConn3)
Conn.Open()
SQL = "INSERT INTO " + Ds.Tables("carregatabela").Rows(j)("TableName") + " ( " + VarCamposInsere + " ) IN '" + ArqDes + "'"
SQL += " SELECT " + VarSelect
SQL += " FROM " + Ds.Tables("carregatabela").Rows(j)("TableName")
Dim Insert As New OleDb.OleDbCommand(SQL, Conn)
Try
'Executa a Query acima
Insert.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
'Exit Sub
End Try
Conn.Close()
where:
ArqDes: Is the destiny path of the access file
StringConn3: Is the origin OLEDB connection of the access file.
When I do this, everything works fine. But when i change the StringConn3 to a SQL Server Connection, using a SQLOLEDB, the system give me the follow error:
"Error in IN syntax. "
Does anyone knows where is it wrong?
Thanks in advance
Angelo