Dear All;
I would like to suggest for a function name getDataToGrid().
Example: I have table name tblStaff(StaffID,StaffName),tblPosition(PositionID,PositionName) and DataGridView anem dgvStaff. For my purpose is, I don't want to write the same code for each forms. That's why I want a function, just call to each form. It can save time and faster. My code is
Private Sub getDataToGrid()
dim cnn as new sqlClient.SqlConnection
dim cmd as new sqlClient.SqlCommand
dim dt as new DataSet
dim da as SqlClient.SqlDataAdater
cmd=new sqlClient.SqlCommand("SELECT * FROM tblStaff",cnn)
cnn.open()
da.SelectCommand=cmd
da.Fill(ds,"tblStaff)
Me.dgvStaff.DataSource=ds.Tables("tblStaff")
End Sub
So, I need a function to get data from table show in GridView.
Best regard,