Hi all,
I am trying to write a bulk copy utility through the ODBC interface. So far, I am able to export table information to a data file in native format by using bcp_init and bcp_exec. However, I can't seem to import data from the data file into a table. The failure seems to occur at the first stage, where I specify DB_IN for bcp_init. I am new to ODBC/bcp programming, so any help would be greatly appreciated. Here is the snippet of c++ code that the program doesn't seem to like:
Thanks,Code:int TbBulkCopy_import(SQLHANDLE hdbc){ RETCODE cliRC = SUCCEED; long cRows; //number of rows bulk processed LPCSTR szTable; //tablename LPCSTR szDataFile; //datafilename LPCSTR szFormatFile; //formatfilename INT direction; //direction of bulkcopy int rc = 0; //for DBC_HANDLE_CHECK to return //szTable = "f_sw.doctaba"; szTable = "f_sw.test_table"; szDataFile = "doctaba.dat"; //szFormatFile = "doctaba.fmt"; /* DB_OUT: table -> datafile */ /* DB_IN: datafile -> table */ direction = DB_IN; /* initialize bulk copy */ cliRC = bcp_init(hdbc, szTable, szDataFile, NULL, direction); if(cliRC != SUCCEED){ printf("\nbcp_init(hdbc) Failed\n\n"); return(9); } ... }
trile



LinkBack URL
About LinkBacks


