Where to store connection info ?

R

Rob

Where is the best place to store database connection info in a vb.net
program ? I do not want to "hard-code" a database name into my program.
Where could I store and retrieve that information ? Also, could you point
in the the right direction as to how one might do it ?

Thanks
 
C

Cor Ligthert

Rob,

The nice thing from (the first used) connectionstring is that you cannot
store it in a database.

Therefore you have the choise from an XML file, and than make simple a
dataset by hand or the registry (and than it has to be typed the first time
in)

I hope this helps,

Cor
 
C

Cor Ligthert

Rob,

Creating a dataset, directly typed in this message so watch typos or
whatever,
\\\
dim ds as new dataset
dim dt as new datatable
ds.tables.add(dt)
dt.columns.add()
dt.loaddatarow(new object() {"myconnectionstring"},true)
ds.writexml("myfilepath")
///
Reading it back
\\\
ds.readxml("myfilepath")
myconnectionstring = ds.tables(0).rows(0)(0).tostring
///

That is all.

I hope this helps,

Cor
 

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