I am trying to access xfd files from a C# program. Does anyone know what the connection string is? Or better yet, if you have an C# example of the oledbconnection string value, it would make my life much easier.
I can access an excel spread sheet (on my hard drive) VIA a C# program by setting up a connection string, creating a connection object, opening the connection, creating a SQL command, etc.
EXCEL
Created a named range called myrange1 within the
junk.xls worksheet
I can also access a vision file thru EXCEL by installing the ACUODBC driver and defining a system dsn (xyzdata). (I have a xyzdata and xyxdata.xfd file on my hard drive.) Then in Excel, I do a data – get external data –select xyzdata from the new data base query drop down box and the connection completes (It launches the query wizard). I then can bounce thru the wizard and get the correct results
So, I am trying to do a hybrid of the above 2. I want to access the xyzdata from my C# program. I hope this clears up the confusion from my original post.
Go into the ODBC control panel applet and select the ODBC datasource. Turn on tracing, then go through the wizard, thereby tracing the connection and fetch of results. Then turn off the trace!
From the trace you might be able to discern the connection string required.
The general look of an ODBC connection string is:
Code:
DSN=xyzdata;UID=userid;PWD=password;
You may omit the UID and/or PWD parameters if you don't have user/password identification on the datasource (don't know anything about AcuODBC).
The best way I know of creating a connection string is the following:
* On your desktop, create a brand new text file.
* Change the file extension to .udl
* double click on the file, and follow the guides to create a connection to the ODBC source you're interested in.
* When done, exit the wizard, and rename the file extension back to txt.
* Open the file in notepad, and there's your connection string. I don't think, though, that the wizard saves the connection password in the connection string. You'll probably have to add it yourself, and it's something like 'Pwd=1234567;'.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.