Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

declare “data source” in a connection string as 'variable'

$
0
0
:D:D:D

Code:

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    Dim bs As New BindingSource

    m_DataAdapter = New OleDbDataAdapter("SELECT * FROM Table1 ORDER BY ID", "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Users\rebel23\Desktop\sampledata.mdb")

    m_DataAdapter.Fill(m_DataSet)

    bs.DataSource = m_DataSet.Tables(0)
    BindingNavigator1.BindingSource = bs
    txtID.DataBindings.Add("Text", bs, "TextBox6.text")
    txtNames.DataBindings.Add("Text", bs, "TextBox7.text")


In the above code i want to change the "data source" and declare it as TextBox1.text So that the user will decide the data source at run time... Also i want the same for 'Table1' and 'ID' but how to do that??


thanx in advance....:wave::wave::wave:

Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>