Solved

DataGridView Sql Table

Posted on 2011-02-26
1
368 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
[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
1 Comment
 
LVL 11

Accepted Solution

by:
srikanthreddyn143 earned 500 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

628 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