/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
change db-connection
Fra : Susan


Dato : 18-10-06 08:08

Hello,

I have a Form with a ADOC-coonection. Using the properties I point to a
database and a table and I define a connectionstring.

Iwant to usr a commandbutton to change these properties. Is this possible?

Private Sub Command1_Click()
'change adodc1.database
'change adodc1.table
End Sub

Thanks,

Susan





 
 
leerstring (18-10-2006)
Kommentar
Fra : leerstring


Dato : 18-10-06 12:18

I dont't use the adodc-control for getting datas from a db, perhaps use
a connection-object and a recordset-object! I think you have more
control with this.
But anyway, adodc works with a cn-string and an sql-query
(select-statement).
Changeing these two properties should be enough...

Like:

dim cnstring1 As String = " "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\mydb.mdb;User Id=admin;Password=;"" 'with this its
initialised
dim cnstring2 As String = " "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\myotherdb.mdb;User Id=admin;Password=;"" 'a runtime to this
changeable

Private Sub Command1_Click()
adodc1.connectionstring = cnstring2
adodc1.table = "newtable" 'I don't know exactly, could also be an
sql-query?!?
End Sub

Hope I can help
Nullstring


Søg
Reklame
Statistik
Spørgsmål : 177429
Tips : 31962
Nyheder : 719565
Indlæg : 6407950
Brugere : 218878

Månedens bedste
Årets bedste
Sidste års bedste