Have you set a breakpoint in the Update method and checked for the parameter values before calling the SP?
>We have a DataGrid with a update SP in SQL server 2000. The DataGrid_Update fires because we watch it in the profiler. The data from the Grid doesn't make it into the parameters.Does anyone have any ideas on how the data is sent from the client back to the server. The form has a method=post on the form.
>Thanks in advance
>Bruce Carpenter
> See code below...
>
>public void DataGrid1_Update(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
> {
> if (IsPostBack)
> {
> String[] cols = {"@SLD_Results_PK","@SLD_Last_Name","@SLD_First_Name","@SLD_Mid_Name","@SLD_DOB","@SLD_Gender","@SLD_Race","@SLD_Ethnicity","@SLD_Address","@SLD_City","@SLD_State","@SLD_Zip","@SLD_County","@SLD_Encounter_Date","@SLD_Cosite","@SLD_Test_Date","@SLD_Test_Type","@SLD_Result","@SLD_Result_Date","@SLD_Lab_Name","@SLD_Process_Flag"};
>
> int numCols = e.Item.Cells.Count;
> string emailstr = "";
> for (int i=1; i
> {
> String colvalue =((TextBox)e.Item.Cells[i].Controls[0]).Text;
> sqlUpdateCommand1.Parameters[cols[i-1]].Value = Server.HtmlEncode(colvalue);
> emailstr += (colvalue + ",");
> }
>
> //Email(emailstr);
> if (sqlConnection1.State!=System.Data.ConnectionState.Open)
> {
> sqlConnection1.Open();
> }
> try
> {
> sqlUpdateCommand1.ExecuteNonQuery();
>
> DataGrid1.EditItemIndex = -1;
> //sqlDataAdapter1.Fill(sldResults1);
> //DataGrid1.DataSource=sldResults1;
> DataGrid1_Bind();
> }
>
> catch (SqlException exc)
> {
> if (exc.Number == 2627)
> Email("ERROR: A record already exists with the same primary key");
> else
> Email("ERROR: Could not update record, please ensure the fields are correctly filled out");
> }
>
> }
> }
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi