|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get table names from MSAccess DatasourceHello all,
I have a vb6 (not .NET) program using MS Access as the backend. As part of an import form, I need to allow the user to select the table containing the data to be imported. How can I populate a combo with this information? Then, once this value is selected, how can I populate other combos with the column names of the selected table? Thanks, Steven Smith Hi,
Maybe this will help. http://www.vb-tips.com/default.aspx?ID=26f91edd-044c-4e71-8c6c-e9d7983c1e05 Ken ---------------- Show quoteHide quote "Steven Smith" <slu***@webbox.com> wrote in message news:73T0g.2504$LG.31@twister.nyroc.rr.com... > Hello all, > > I have a vb6 (not .NET) program using MS Access as the backend. As part of > an import form, I need to allow the user to select the table containing > the > data to be imported. How can I populate a combo with this information? > Then, once this value is selected, how can I populate other combos with > the > column names of the selected table? > > > Thanks, > > Steven Smith > Thanks Ken... it wasn't quite what I needed, but it pointed me in the right
direction. Show quoteHide quote "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in news:eZe9uonYGHA.3684@TK2MSFTNGP05.phx.gbl: > Hi, > > Maybe this will help. > > http://www.vb-tips.com/default.aspx?ID=26f91edd-044c-4e71-8c6c-e9d7983c > 1e05 > > Ken > ---------------- > "Steven Smith" <slu***@webbox.com> wrote in message > news:73T0g.2504$LG.31@twister.nyroc.rr.com... >> Hello all, >> >> I have a vb6 (not .NET) program using MS Access as the backend. As >> part of an import form, I need to allow the user to select the table >> containing the >> data to be imported. How can I populate a combo with this >> information? Then, once this value is selected, how can I populate >> other combos with the >> column names of the selected table? >> >> >> Thanks, >> >> Steven Smith >> > > Steven,
Somebody else was asking the same question, maybe we should extend our sample with the schema information. http://msdn2.microsoft.com/en-us/library/kcax58fh(VS.80).aspx But using that sample the schema option easy to find and it works the same.. I hope this helps, Cor Show quoteHide quote "Steven Smith" <slu***@webbox.com> schreef in bericht news:_vY0g.2742$u27.940@twister.nyroc.rr.com... > Thanks Ken... it wasn't quite what I needed, but it pointed me in the > right > direction. > > > > "Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in > news:eZe9uonYGHA.3684@TK2MSFTNGP05.phx.gbl: > >> Hi, >> >> Maybe this will help. >> >> http://www.vb-tips.com/default.aspx?ID=26f91edd-044c-4e71-8c6c-e9d7983c >> 1e05 >> >> Ken >> ---------------- >> "Steven Smith" <slu***@webbox.com> wrote in message >> news:73T0g.2504$LG.31@twister.nyroc.rr.com... >>> Hello all, >>> >>> I have a vb6 (not .NET) program using MS Access as the backend. As >>> part of an import form, I need to allow the user to select the table >>> containing the >>> data to be imported. How can I populate a combo with this >>> information? Then, once this value is selected, how can I populate >>> other combos with the >>> column names of the selected table? >>> >>> >>> Thanks, >>> >>> Steven Smith >>> >> >> > > I forgot to type it complete, therefore the link was still in my clipboard.> Somebody else was asking the same question, maybe we should extend our > sample with the schema information. > On Mon, 17 Apr 2006 20:40:35 GMT, Steven Smith <slu***@webbox.com> wrote:
¤ Hello all, ¤ ¤ I have a vb6 (not .NET) program using MS Access as the backend. As part of ¤ an import form, I need to allow the user to select the table containing the ¤ data to be imported. How can I populate a combo with this information? ¤ Then, once this value is selected, how can I populate other combos with the ¤ column names of the selected table? ¤ List of Tables: Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Test Files\db1 XP.mdb" DatabaseConnection.Open() SchemaTable = DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, Nothing}) Dim RowCount As Int32 For RowCount = 0 To SchemaTable.Rows.Count - 1 TableListCombo.Items.Add(SchemaTable.Rows(RowCount)!TABLE_NAME.ToString) Next RowCount DatabaseConnection.Close() List of Columns: Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Test Files\db1 XP.mdb" DatabaseConnection.Open() SchemaTable = DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns, _ New Object() {Nothing, Nothing, "Table1"}) Dim RowCount As Int32 For RowCount = 0 To SchemaTable.Rows.Count - 1 ColumnListCombo.Items.Add(SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString) Next RowCount DatabaseConnection.Close() Paul ~~~~ Microsoft MVP (Visual Basic) Thanks!
Paul Clement <UseAdddressAtEndofMess***@swspectrum.com> wrote in Show quoteHide quote news:afq942loajeenhonpml7a8hdudsu20hg1m@4ax.com: > On Mon, 17 Apr 2006 20:40:35 GMT, Steven Smith <slu***@webbox.com> > wrote: > > ¤ Hello all, > ¤ > ¤ I have a vb6 (not .NET) program using MS Access as the backend. As > part of ¤ an import form, I need to allow the user to select the table > containing the ¤ data to be imported. How can I populate a combo with > this information? ¤ Then, once this value is selected, how can I > populate other combos with the ¤ column names of the selected table? > ¤ > > List of Tables: > > Dim DatabaseConnection As New > System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable > > DatabaseConnection.ConnectionString = > "Provider=Microsoft.Jet.OLEDB.4.0;" & _ > "Data Source=C:\Test Files\db1 XP.mdb" > > DatabaseConnection.Open() > > SchemaTable = > DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGui > d.Tables, _ > New > Object() {Nothing, Nothing, Nothing, > Nothing}) > > Dim RowCount As Int32 > For RowCount = 0 To SchemaTable.Rows.Count - 1 > TableListCombo.Items.Add(SchemaTable.Rows(RowCount)!TABLE_N > AME.ToString) > Next RowCount > > DatabaseConnection.Close() > > List of Columns: > > Dim DatabaseConnection As New > System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable > > DatabaseConnection.ConnectionString = > "Provider=Microsoft.Jet.OLEDB.4.0;" & _ > "Data Source=C:\Test Files\db1 XP.mdb" > > DatabaseConnection.Open() > > SchemaTable = > DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGui > d.Columns, _ > New Object() {Nothing, Nothing, "Table1"}) > > Dim RowCount As Int32 > For RowCount = 0 To SchemaTable.Rows.Count - 1 > ColumnListCombo.Items.Add(SchemaTable.Rows(RowCount)!COLUMN > _NAME.ToString) > Next RowCount > > DatabaseConnection.Close() > > > Paul > ~~~~ > Microsoft MVP (Visual Basic)
devenv.exe CPU 100%
help with converting from VB4.0 knowing when file has been totally transferred urgent: formatting XL cells Reusing VB.NET Form dialogs in VC apps Ubound() collection question Newbe help with Receive Serial Data Function Looking for a line graph control. stopping current execution |
|||||||||||||||||||||||