CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2001
    Posts
    31

    ERROR: NOT RESPONDING

    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






  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Not responding...(Mind your CapsLock)

    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
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured