b001
asked on
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.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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.