• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

DataGridView Sql Table

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.CommandText = "INSERT INTO FMSTEMP (COL1,COL2) VALUES (1245,'IDOX')"
 I would like to show data form FMSTEMP table in DataGridView
 DataGridView1.DataSource = "FMSTEMP"
It doesn't work.
Please help
1 Solution
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)
DataGridView1.DataSource = ds
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now