Well I am not sure that that is the right thing to be doing. This is my
first attempt at creating a working Datagrid and having it update to a
database. What I have right now to pull the data is the following code. I
think though that I saw somewhere that I don't need to open and close the
connections though since the dataadapter is supposed to do this. I have
made some fields in the grid editable and want those changes to hit the
database at the same time with an update button that I have at the bottom of
the grid. From here I have no idea how to get the updates submitted to the
database. This is a webform. I am so lost on this part. Form fields to
the database are easy, but updating from a datagrid I am getting confused.
OleDbConnection conn = new
OleDbConnection(ConfigurationSettings.AppSettings["FleetConnectionString"]);
conn.Open();
OleDbDataAdapter cmd = new OleDbDataAdapter(sqlQuery, conn);
cmd.SelectCommand.Parameters.Add("@cuid", OleDbType.VarChar, 20).Value =
Session["CUID"];
DataSet dsFleet = new DataSet();
cmd.Fill(dsFleet);
DataGrid1.DataSource = dsFleet;
DataGrid1.SelectedIndex = 0;
DataGrid1.DataBind();
conn.Close();
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uD**************@tk2msftngp13.phx.gbl...
Brian,
Why would you loop through a data grid? If anything, I would think
that you want to create a data adapter, and then have it update the underlying
data source based on the changes that have occured.
Also, are you using Windows Forms or ASP.NET?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Brian Conway" <Br**********@qwest.com> wrote in message
news:eI*************@TK2MSFTNGP10.phx.gbl... Can anyone give me an example of how I can loop through a datagrid and
have it run a stored procedure each time it loops?