WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ODBC
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Create a System DSN for a TXT File Problem


Question:

I am tring to have winbacth create a system dsn but I keep on getting the following error
qconfigdata failed:
Component not found in registry

AddExtender("wwodb34i.dll")

;Create DSN
request=1;ODBC_ADD_DSN
driver="Microsoft Text Driver (*.txt;*.csv)" 
attrs="DSN=SUNTAN_SUPPLIES_IMPORT|DESCRIPTION=Connection|DBQ=C:\TSG\OpenOrder.txt|FIL=|";colon delimited
displayflag=@false
ret=qConfigData(request, driver, attrs, displayflag)
if ret== @False
message("qConfigData failed", qConfigError())
exit
Endif
message("qConfigData - Created DSN",ret)

exit

Answer:

The driver is missing a space detween the (*.txt; *.csv) Here is the correct code.
AddExtender("wwodb34i.dll")

;This Creates an SYSTEMDSN
request=4;<---------ODBC request
driver="Microsoft Text Driver (*.txt; *.csv)" ;<----------sensitive Driver name as it is in the ODBC
DSN="DSN=THIS_ONE_NOW";<------------------------------------What you want the DSN name to be
DESCRIPTION="DESCRIPTION=Testing purposes";<------------------If you would like a desc
DBQ="DBQ=C:\TSG";<-------------------Where the file is located
FIL="FIL=text;" ;<------------------What the file type is
attrs= Strcat (DSN,"|",DESCRIPTION,"|",DBQ,"|",FIL,"|")
message ("","%attrs%")
displayflag=@FALSE
ret=qConfigData(request, driver, attrs, displayflag)
if ret== @False
message("qConfigData failed", qConfigError())
exit
Endif
message("Created DSN","%DSN%,%Driver%")

exit 
-------------------------------------------------------------------------------- Post New Topic | Reply to: "Create a System DSN for a .txt file"
Article ID:   W16340
File Created: 2017:07:28:13:58:31
Last Updated: 2005:02:18:12:19:54