Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using SQLConfigDataSource in VB.NET doesnt work for MS text Driver

Status
Not open for further replies.

crystalReporterNew

Programmer
Jan 18, 2004
24
US
Hi,
I am trying to set up a DSN for Microsoft text driver. If I write the following code, I get the error that DSN entry Failed:

intret = SQLConfigDataSource(0&, ODBC_ADD_DSN, "Microsoft Text Driver(*.txt,*.csv)", "DSN=AppliedEDSN")
If intret Then
MessageBox.Show("DSN Added")
Else
MessageBox.Show("DSN Entry Failed")
End If


HOwever if I replace the driver with SQL Driver or with MySQL ODBC 3.51 Driver , it adds the DSN .Can someone tell me whats wrong with the text driver? Actually the code doent work for Microsoft Access Driver(*.mdb) too

Please help
Thanks
 
If you transcribed the code as it is in your application, I would say that your problem is that the name of the driver is not correct. There should be a space before the parenthesis and the file list in the text driver is separated by a semi-colon not a comma. The drivers should read like the following
Code:
"Microsoft Text Driver (*.txt; *.csv)"
"Microsoft Access Driver (*.mdb)"

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top