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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to connect UDL to data Enviroment?

Status
Not open for further replies.

Som76

Programmer
Jun 25, 2003
50
IN
Hello Everyone,

I have my connection string in the UDL file.

In my project i have a Data Enviroment for the Data Reports. I want to set the connection string of Data Enviroment dynamically to the UDL file.

Please can any one help me.

Thanks
Som
 
Please someone help me how i will set the connection of Data Enviroment dynamically.

I want to set the connection of DataEnviroment to my database through a UDL file.

Som
 
Try this:

With DataEnvironment1
If .Connection1.State <> 0 Then
.Connection1.Close
End If
.Connection1.Open &quot;File Name=c:\fred.udl;&quot;
End With


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Hi john

I tried with this code.
But i am getting a runtime error -2147024809
'The parameter is incorrect.'

Please can u check this one again.

Thanks
Som
 
Are you using the full path to your UDL? - the one above works for me.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Hi John

Yes I am giving the full correct path.

I get this error if I delete the connection string from DataEnviroment.

It works only if the connection string in my DataEnviroment & through code are same, ie if specify
&quot;File Name=c:\fred.udl&quot; at both the places, in DE & in Code as well. If I remove this from DE & keep only in code, it gives me the runtime error.

I don't mind to keep in both the places, so now it works for me.

Thanks again for ur kind help. U can also try this removing the Connection String from DE and keeping the code only.

Cheers
Som
 
Hi

I am still getting the run time error -2147024809

Although I set &quot;File Name=c:\Elepost.udl&quot; is in both the places ie at DataEnviroment and in the code, still gives me the run time error when i try to set the connection string property through code.

Dim DE As New DataEnvironment1
DE.Connection1.ConnectionString = &quot;File Name=&quot; & App.Path & &quot;\Elepost.udl&quot;

Please anyone can help.
Som
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top