Solved

DataGridView Sql Table

Posted on 2011-02-26
1
353 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 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now