how to use file udl in .NET

T

Tom

I've got some file UDL's I use with my current 6.0 apps.
I want to use them with .NET, but I can't get the
connection right. Basically, I'm doing this (C#):

strConnect = "File Name=" + HttpRuntime.AppDomainAppPath
OdbcConnection con1 = new OdbcConnection();
con1.ConnectionString = strConnect;
con1.Open ();

But I get a message telling me "File Name" is not a good
keyword. Can anyone give an example of how to use my UDL
files with .NET? (I've also tried using a sqlConnection
object, but it doesn't work either)

thanks
 
P

Paul Clement

¤ I've got some file UDL's I use with my current 6.0 apps.
¤ I want to use them with .NET, but I can't get the
¤ connection right. Basically, I'm doing this (C#):
¤
¤ strConnect = "File Name=" + HttpRuntime.AppDomainAppPath
¤ OdbcConnection con1 = new OdbcConnection();
¤ con1.ConnectionString = strConnect;
¤ con1.Open ();
¤
¤ But I get a message telling me "File Name" is not a good
¤ keyword. Can anyone give an example of how to use my UDL
¤ files with .NET? (I've also tried using a sqlConnection
¤ object, but it doesn't work either)

I thought UDLs were for OLEDB? Do your UDLs actually contain ODBC connection strings?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
T

Tom

You're right, the UDL's contain OLEDB info. I tried both
the ODBC and SQL connection objects so far. Maybe I'll
try the OLEDBConnection object next. But if anyone has a
good example, it is always appreciated.

-----Original Message-----
¤ I've got some file UDL's I use with my current 6.0 apps.
¤ I want to use them with .NET, but I can't get the
¤ connection right. Basically, I'm doing this (C#):
¤
¤ strConnect = "File Name=" + HttpRuntime.AppDomainAppPath
¤ OdbcConnection con1 = new OdbcConnection();
¤ con1.ConnectionString = strConnect;
¤ con1.Open ();
¤
¤ But I get a message telling me "File Name" is not a good
¤ keyword. Can anyone give an example of how to use my UDL
¤ files with .NET? (I've also tried using a sqlConnection
¤ object, but it doesn't work either)

I thought UDLs were for OLEDB? Do your UDLs actually
contain ODBC connection strings?
 
P

Paul Clement

¤ You're right, the UDL's contain OLEDB info. I tried both
¤ the ODBC and SQL connection objects so far. Maybe I'll
¤ try the OLEDBConnection object next. But if anyone has a
¤ good example, it is always appreciated.
¤

Yes, it should work with the OLEDB library. I wasn't able to find a way using the ODBC library.

Dim OracleConnection As New System.Data.OleDb.OleDbConnection()

OracleConnection.ConnectionString = "File Name=c:\temp\OracleFile.udl"

OracleConnection.Open()

'...
'...

OracleConnection.Close()


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top