Click to See Complete Forum and Search --> : ERROR: NOT RESPONDING


Karina Gámez
September 5th, 2001, 04:37 PM
HI..
ITS ME AGAIN..

IM WORKING WITH BCP, SQLDMO AND VB6.0 WITH SQL SERVER 7.0
WHEN I RUN MY APPLICATION, IN MY TASK MANAGER SAYS "NOT RESPONDING" , (IM TRYING TO IMPORT TXT INTO A TEMPORAL TABLE )
BUT, THE THING.. IS .. WHEN I OPEN MY QUERY ANALYZER AND MAKE A QUERY.. THIS SEEMS TO WORK... LET ME TRY TO EXPLAIN.. .. MY QUERY RETURN ALL THE ROWS THAT I WAS IMPORTED... DO U KNOW WHAT I MEAN.. BUT MY APPLICATION IS NOT WORKING ANYMORE

ANYBODY KNOW WHAT COULD BE????? ITS URGENT!!

THIS IS MY CODE:

private Sub cmdiniciar_Click()

'Instanciamos los objetos
set objBCP = new SQLDMO.BulkCopy
set objServer = new SQLDMO.SQLServer
set objDB = new SQLDMO.Database

on error GoTo ErrorHandler

With objServer
.EnableBcp = true
.LoginSecure = true
.Connect ServerName, UserName, Password
End With
set objDB = objServer.Databases(DatabaseName)

With objBCP
.SetCodePage SQLDMOBCP_OEM
.UseBulkCopyOption = true
.ColumnDelimiter = "|"
.DataFileType = SQLDMODataFile_SpecialDelimitedChar
.DataFilePath = FArchivo.Path & selectedFile
.ErrorFilePath = "c:\errores.log"
.ImportRowsPerBatch = 100
'.MaximumErrorsBeforeAbort = 5000
.RowDelimiter = vbCrLf 'Carriage return
.ServerBCPDataFileType = SQLDMOBCPDataFile_Native
.ServerBCPKeepNulls = true
.SuspendIndexing = false
.UseExistingConnection = true
End With


If optexporta.Value = false then
objDB.Tables(Tablename).ExportData objBCP
Debug.print "nCount " & ncount
objServer.Disconnect
set objServer = nothing
else
objDB.Tables(Tablename).ImportData objBCP (THIS is WHERE MY APPLICATION DID NOT WORK..WHEN I CALL THE IMPORT DATA, BUT THE INFORMATION WAS IMPORTED INTO THE TABLE!!!)
objServer.Disconnect
objServer.Close
set objServer = nothing
End If
cn.Close ' cerramos la conexion
set cn = nothing 'liberamos la conexion
End

ErrorHandler:
Call MsgBox("Descripción :" & Err.Description, vbCritical + vbOKOnly, "error ")
set objBCP = nothing
set objServer = nothing
set objDB = nothing

End Sub

Cimperiali
September 6th, 2001, 02:55 AM
I cannot help with BCP and SQLDMO, but I saw something not good in your code:
"End" instruction is not good.
Before quitting your program you should be sure to close all opened object and
to set references to nothing.
To quit your program use then the unload statement for each loaded form.





Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater