How to insert text into a datagrid?

kmdames

New member
Joined
Jan 3, 2009
Messages
3
Programming Experience
1-3
After I have retrieved my data from my access database, I would like to insert text into one of the columns in a new row. Is this possible? Here's a snipit of my code I use to retrieve the data from access:

If con.State = ConnectionState.Closed Then con.Open()
sdr = cmd.ExecuteReader()
rtime = Now()
While sdr.Read = True
If sdr.Item("total_time") <> "0" Then
rtime_in = sdr.Item("clock_in")
rtime_out = sdr.Item("clock_out")
rdtotal_time = rtime_out.Subtract(rtime_in)
rtotal_time = rtotal_time.Add(rdtotal_time)
End If
End While
sdr.Close()
rstotal_time = rtotal_time.Duration.ToString
timelabel.Text = rstotal_time
If con.State = ConnectionState.Closed Then con.Open()
myDA = New OleDbDataAdapter(cmd)
myDataSet = New DataSet()
myDA.Fill(myDataSet)
DataGridView1.DataSource = myDataSet.Tables("Table").DefaultView

It's the rtotal_time value that I need to insert into the datagrid.

Any help would be appreciated.
 
Delete everything you have written, and then read the DW1 link in my signature, section called Simple Data Access in a Windows Form

Oh, and do find the time to upgrade your VS - your IDE is ~7 years old now and much better, free offerings are available to amke your life easier
 

Latest posts

Back
Top