LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write UDL file in Labview for Database connection

Hi

I am using SQL Server database. I am making connection with SQL by using UDL file. If I create  Normal UDL file in windows and make connection it happens.  I want to change or add some parameter Like database name. If I am changing this value by using labview, the file gets corrupted, and not able to make connection with SQL.

I want to create database by program. User should not create the database. 

Kindly suggest me the proper solution. 

 

Regards

Prabhakant Patil

prabhakantpatil@gmail.com 

Regards
Prabhakant Patil
0 Kudos
Message 1 of 6
(6,101 Views)

Hi Prabhakant Patil,

see this link please. Maybe it's what you are searching for.

 

 

Mike

0 Kudos
Message 2 of 6
(6,098 Views)

 

 

 

 

 

This Solution  Wont help me Out. I dont want to Use ODBC, thats why I am using UDL and SQL server.  When I use the UDL file it make connection with the SQL server. but the Thing is that if am editing the UDL file through Labview, then it gets corupted. so not able to make connection again.

Regards
Prabhakant Patil

Regards
Prabhakant Patil
0 Kudos
Message 3 of 6
(6,083 Views)

If you look at the two files (i hope/assume you save to another file name while debugging) in notepad - are they similar, or is the corruption visible?

You should have a part with Data Source=[server]\[database], you didn't forget one part in the update?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 6
(6,065 Views)

I wouldn't try to change the UDL file using LabVIEW.  What about creating different UDL files that your program can choose from?  The other option would be to treat the UDL file as a pure text file, but that sounds like a lot of nasty parsing to me...

 

Try going to this thread for more info.  

-------------------
Greg
Certifed LabVIEW Developer
0 Kudos
Message 5 of 6
(6,056 Views)

It may look like a text file, but it's not a text file that uses plain-old ASCII. If you open it in Notepad you won't see anything obvious. You actually have to open the UDL file with a hex editor, and you will see the differences. Specifically:

  • The file starts with the header FF FE. This indicates Unicode. LabVIEW does not support Unicode.
  • Each characters is actually 2 bytes. Thus, the first character you see in Notepad is "[" (for the section start). In hex this is 05 for plain-old ASCII, but 05 00 for Unicode (which is what's actually in the file).

 

Thus, if you absolutely must write out the file using LabVIEW you will need to write it out in binary mode, inserting the 0x00 bytes, and the FF FE at the start. 

Message Edited by smercurio_fc on 03-24-2010 09:39 AM
Message 6 of 6
(6,049 Views)