|
-
Jul 13th, 2005, 10:23 PM
#1
Thread Starter
New Member
VB2VB.NET: INI file or XML?
In VB programmers offten keep database connection parameter in a INI file, it looks like as blow
[database]
Driver={SQL Server}
Server=.
uid=sa
pwd=
database=myDB
do VB.NET programmers use it also? or keep them in a XML file? which one are most recommended way?does anybody have a sample?
-
Jul 14th, 2005, 12:27 AM
#2
Re: VB2VB.NET: INI file or XML?
The XML file is the preferred way, replacing the registry and ini files both. 
You can find some examples of using XML files in the download from MS in the 101 .NET tutorials at the top of the VB.NET forum or
do a quick search in the VB.NET Forum.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 14th, 2005, 01:24 AM
#3
Re: VB2VB.NET: INI file or XML?
VS 2005 has made it even easier to store program settings, but 2003 is part way there. You can create your own XML files, or you can use dynamic properties and the app's config file. If you have created your database Connection object in the designer, a mechanism already exists, via DynamicProperties in the Properties window, to have the connection string stored in the config file, which will be created for you and added to your project. You then simply have to distribute that config file with your app and edit the appropriate line(s) using Notepad. The connection string is picked up automatically every time your app starts with no extra code needed. With dynamic properties, I think you could also provide a way for the user to change the data source through your app, then have that new value saved to the config file when the app exits. I haven't really used them but I think all controls can set Dynamic Properties in a similar way. You can also create your own custom sections in the config file and read them using the System.Configuration namespace. Be aware, though, that there is no easy way to edit the config file programmatically.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|