Solved

How to add database table to a text field

Posted on 2006-07-11
3
190 Views
Last Modified: 2010-04-23
My questions is How to add database table to a text field when i use a button clickit should show me the table details when click
0
Comment
Question by:LeowWeeBoon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
foobarr earned 20 total points
ID: 17081106
what database server are you using?

when you say show you the details of the table do you mean the query "describe tblname" ?



I'm assuming you know how to create your connection string

public function describeTable(byval tblName as string) as dataset
   Me.myQueryString = "describe " & tblName

        myCommand = New MySqlCommand(myQueryString, myConnection)
        Try
            myDataAdapter = New MySqlDataAdapter()
            myDataAdapter.SelectCommand = myCommand
            ds = New DataSet
            myDataAdapter.Fill(ds, tblName)

            Return ds

        Catch ex As MySqlException
            MessageBox.Show("DB ERROR: Cannot Return Column See Error Trace" & Environment.NewLine & ex.Message, "DB ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)

            ds = New DataSet
            Return ds


        End Try

end function


to call this function go

dim dSet as new dataset
dim pRow as datarow


dSet = describeTable("table1")

for each pRow in dSet.Tables("table1").rows

textbox1.text = pRow("ColumnName1").toString & "\t" & pRow("ColumnName2").tostring, etc. etc.

next

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question