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

x
?
Solved

DataGridView Sql Table

Posted on 2011-02-26
1
Medium Priority
?
378 Views
Last Modified: 2012-08-13
Hi Experts
 I created a temporary Sql table and inserted some data into it using the following code

     
        Dim cmd As SqlCommand = New SqlCommand()
        cmd.Connection = cn
        cmd.CommandText = "Create Table FMSTEMP (col1 int, col2 nvarchar(20))"
        cmd.ExecuteNonQuery()
          cmd.CommandText = "INSERT INTO FMSTEMP (COL1,COL2) VALUES (1245,'IDOX')"
        cmd.ExecuteNonQuery()
 
 I would like to show data form FMSTEMP table in DataGridView
 DataGridView1.DataSource = "FMSTEMP"
It doesn't work.
Please help
0
Comment
Question by:b001
1 Comment
 
LVL 11

Accepted Solution

by:
srikanthreddyn143 earned 2000 total points
ID: 34987551
You need to get the data again this way

cmd.commantext = "select * from FMSTEMP"

Dim ds as dataset
Dim Adap As New Sqladapter(cn,cmd)
Adap.fill(ds)
DataGridView1.DataSource = ds
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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
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…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

783 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