Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to add database table to a text field

Posted on 2006-07-11
3
Medium Priority
?
201 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
3 Comments
 
LVL 7

Accepted Solution

by:
foobarr earned 80 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

886 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