how to fill datagrid by using this code..? [RESOLVED!!!]
can sum1 help me how can I fill the datagrid (dg1) with data through this code..
Try
'SET UP A SQL COMMAND
strSQL = "select SOCSO_id,salary_from,salary_to,Emplyr_Contrbn,Emplyee_Contrbtn from SOCSO "
myConnection = New OleDb.OleDbConnection(sConnString)
Dim myCommand As New OleDbCommand(strSQL, myConnection)
myConnection.Open()
'DO THE QUERY
Dim dr As OleDbDataReader = myCommand.ExecuteReader
dr.Read()
'/////////////////////////////////////
'IS THAT I SUPPOSE FILL HERE IF SO CAN GUIDE ME
'/////////////////////////////////////
dr.Close()
myConnection.Close()
Catch exceptionObject As Exception
MessageBox.Show(exceptionObject.Message)
End Try
=====================
or if u hv any alternative way plz let me know ..
fyi im using sql server2000 as backend and i prefer oledbConnection...
help me n God may Bless u
can sum1 help me how can I fill the datagrid (dg1) with data through this code..
Try
'SET UP A SQL COMMAND
strSQL = "select SOCSO_id,salary_from,salary_to,Emplyr_Contrbn,Emplyee_Contrbtn from SOCSO "
myConnection = New OleDb.OleDbConnection(sConnString)
Dim myCommand As New OleDbCommand(strSQL, myConnection)
myConnection.Open()
'DO THE QUERY
Dim dr As OleDbDataReader = myCommand.ExecuteReader
dr.Read()
'/////////////////////////////////////
'IS THAT I SUPPOSE FILL HERE IF SO CAN GUIDE ME
'/////////////////////////////////////
dr.Close()
myConnection.Close()
Catch exceptionObject As Exception
MessageBox.Show(exceptionObject.Message)
End Try
=====================
or if u hv any alternative way plz let me know ..
fyi im using sql server2000 as backend and i prefer oledbConnection...
help me n God may Bless u
Last edited: