Hi,

I'm already create connection to database with datagridview to view the data. I also create header unbound like this :- STUDENT ID,STUDENT NAME,REMARKS(CHECKBOX).

I need to pull data from database with column SM_STUDENT_ID,SM_STUDENT_NAME then insert under this datagridview column.....how to do that..c.an anyone assist me.....so long to setle it..plzzzz

Here is an example of connecting to MSSQL and pulling back a result set:

Imports System.Data.SqlClient

Public Class FormSql

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Const connStr As String = "Data Source=apex2006sql;Initial Catalog=Leather;Integrated Security=True;"
		Const query As String = "Select Top 30 * From Invoice"
		Dim conn As New SqlConnection(connStr)
		conn.Open()
		Dim cmd As New SqlCommand(query, conn)
		Dim dr As SqlDataReader = cmd.ExecuteReader()
		Dim dt As New DataTable()
		dt.Load(dr)
		cmd.Dispose()
		conn.Close()
		conn.Dispose()
		DataGridView1.DataSource = dt
	End Sub
End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.