Sorry you didnt like it.
I just took the code generated with the creation of the connection string
and replaced the path with the database variable.
xml file loaded at startup provides this info.
The only downside that I have encountered is you can't put it in a module as
I kept getting intialization errors. You might have a thought on that I
could use.
I had to do encryption(the whole string and then grabbing it out of an xml
file) to deal with the password problem in SQL and when one was required in
access but it worked. Sorry for the unnecessary code that is here but it is
what I had opened at the time.
'xml file for user choice of connection
<?xml version="1.0" encoding="utf-8" ?>
<Section Name="Settings" >
<Key Name="databasep ath" Value="C:\datab ase.mdb"/> 'user fills this when
using open dialog box
</Section>
Loading the file at startup of app....
Private Sub ReadXmlConfig()
' Create Xml Document and load the xml file
Dim xmlDoc As XmlDocument = New XmlDocument
xmlDoc.Load("C: \Neumann Plumbing and Heating\XMLDBPA TH.xml") 'can
use appdirectory when finished with project.
' Read mail server value
Dim keyNodeList As XmlNodeList =
xmlDoc.Document Element.SelectN odes("Key")
Dim keyNode As XmlNode
For Each keyNode In keyNodeList
' Read the attributes...
Dim attribs As XmlAttributeCol lection = keyNode.Attribu tes
Dim attrib As XmlAttribute = attribs("Name")
If attrib.Value = "databasepa ths" Then
databasepath = attribs("Value" ).Value.ToStrin g()
'MsgBox(databas epath)
End If
Next
End Sub
Using the connection:
Sub GetComboBoxFill s()
Dim sConn1 As New OleDb.OleDbConn ection
sConn1.Connecti onString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet
OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Jet OLEDB:Database Password=;Data Source=" &
databasepath & _
";Password= ;Jet OLEDB:Engine T" & _
"ype=5;Jet OLEDB:Global Bulk
Transactions=1; Provider=""Micr osoft.Jet.OLEDB .4.0"";Je" & _
"t OLEDB:System database=;Jet OLEDB:SFP=False ;Extended
Properties=;Mod e=Share Den" & _
"y None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System
Database=False; J" & _
"et OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact
Without Replica Re" & _
"pair=False;Use r ID=Admin;Jet OLEDB:Encrypt Database=False"
Dim itemcheck As Integer
Dim dscustomers2 As DataSet 'customer company
'more datasets not relevant here
dscustomers2 = Dscustomers1.Cl one
Dim SQL3 As String
'more strings not relevant here
SQL3 = "SELECT DISTINCT CustCompanyName FROM CUSTOMERS order by
CustCompanyName "
dscustomers2.En forceConstraint s = False
Dim OleDbCUSTCOMPAN Y As New OleDb.OleDbData Adapter 'customer COMPANY
OleDbCUSTCOMPAN Y = OleDbDBCUST
OleDbCUSTCOMPAN Y = New OleDb.OleDbData Adapter(SQL3, sConn1)
OleDbCUSTCOMPAN Y.Fill(dscustom ers2.Tables(0))
'more fills not relevant here
dscustomers2.Ac ceptChanges()
sConn1.Close() 'very important
"Cor" <no*@non.com> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi Scorpion,
The problem with this is that if you have made your connection string by
hand, you can do everything you want with it.
But when you use the generic tools, as far as I know till now, you cannot
do anything with it.
The sequence in that part is something like:
- connection string
- open connection
And you cannot come between that in the designer part.
When you change something, the designer corrects it full automatically for
you, if you want to change the slightest thing, the next time.
Therefore I think that designer thing is useless for commercial software.
Inside an organisation it will maybe work, if you are able to put from the
start on your database on the end place.
I follow this kind of messages like a hawk, but I have seen no good answer
till now.
Cor