I’m trying to import a table into a secured sql database using vb.net but it seems to timeout (or so I think) and not import properly (null value), I truncate the table to save the field types and then call the shell() function to import the file and
'Clean out the existing data in the validation import table
cmd.CommandText = "TRUNCATE TABLE HedgeFileBuilders.dbo.HedgeInput_" & strProduct & "_VALIDATOR;"
cmd.ExecuteNonQuery()
're-import the inforce file to validate it
Try
If chkSQLServerSource Then
Shell(SQLLOCALDIR & "Prog\bcp.exe FileBuilders.dbo.Input_" & strProduct & "_VALIDATOR in " & strFileName & " -c -t , -r \n -S server -U user -P passkey -F 2 -h TABLOCK", AppWinStyle.Hide, True)
Else
Shell(SQLLOCALDIR & "Prog\bcp.exe FileBuilders.dbo.Input_" & strProduct & "_VALIDATOR in " & strFileName & " -c -t , -r \n -S pcname -T -F 2 -h TABLOCK", AppWinStyle.Hide, True)
End If
Catch ex As Exception
MessageBox.Show("ERROR: An error occurred while re-importing the new business file. Contact the system administrator. " & ex.Message, "Contact System Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
'THIS DOESN'T Return and Error but null results. I do the import manually in SQL and it works (all the data is there). I even use the strFilename and Table name indicated above from vb code to make sure I didn't get the names wrong when importing manually.
What am I doing wrong?
P.S. I tried the timeout integer parameter '-l', after the boolean 'True' above and it did not help.