always gull

always gull

  • NA
  • 32
  • 0

Converting grid values to lower case for update

Feb 25 2009 2:03 PM
Hi I have a problem i hgaave a table in data grid view and i am updating data from data using a button. what i need to do is once the user update the data and click on update button i want to convert all string values to lower case. i am not using data table to populate my grid, is their any way that i can do that  here is my code i am using to upgrade my grid

private void cmd_update_record_Click(object sender, EventArgs e)
        {



            if (dgRepair.RowCount == 0)
            {

                MessageBox.Show("No data available for update");
            }


            else
            {
              
                DataSet ChangedRepDataSet = new DataSet();
                ChangedRepDataSet = ds_rep.GetChanges();
               
               
                if (ChangedRepDataSet != null)
                {
                   
                   
                    // Intializing object of Connectionclass to open connection
                    conn_obj = new ConnectionClass();
                    store_connection = conn_obj.connect();
                    // Sqlcommand object
                    SqlCommand cmdupdate;
                    cmdupdate = new SqlCommand();
                    cmdupdate.CommandType = CommandType.StoredProcedure;
                    cmdupdate.CommandText = "Update_Status_Grid";

                    //opening connection
                    cmdupdate.Connection = store_connection;
                    store_connection.Open();

                    //Adding Parameters  for Repair table

                    cmdupdate.Parameters.Add("@OrgDescription", SqlDbType.VarChar, 100, "Description");
                    cmdupdate.Parameters["@OrgDescription"].SourceVersion = DataRowVersion.Original;
                    cmdupdate.Parameters.Add("@Description", SqlDbType.VarChar, 100, "Description");
                    cmdupdate.Parameters.Add("@OrgStatus", SqlDbType.VarChar, 15, "Status");
                    cmdupdate.Parameters["@OrgStatus"].SourceVersion = DataRowVersion.Original;
                    cmdupdate.Parameters.Add("@Status", SqlDbType.VarChar, 15, "Status");
                    cmdupdate.Parameters.Add("@OrgPartDes", SqlDbType.VarChar, 50, "PartDes");
                    cmdupdate.Parameters["@OrgPartDes"].SourceVersion = DataRowVersion.Original;
                    cmdupdate.Parameters.Add("@PartDes", SqlDbType.VarChar, 50, "PartDes");
                    cmdupdate.Parameters.Add("@OrgRepAction", SqlDbType.VarChar, 50, "RepAction");
                    cmdupdate.Parameters["@OrgRepAction"].SourceVersion = DataRowVersion.Original;
                    cmdupdate.Parameters.Add("@RepAction", SqlDbType.VarChar, 50, "RepAction");
                    cmdupdate.Parameters.Add("@OrgId", SqlDbType.BigInt ,1000, "Id");
                    cmdupdate.Parameters["@OrgId"].SourceVersion = DataRowVersion.Original;

                   //Adding the Parameters for invoice table
                    cmdupdate.Parameters.Add("@OrgRepCost", SqlDbType.Money, 1000, "RepCost");
                    cmdupdate.Parameters["@OrgRepCost"].SourceVersion = DataRowVersion.Original;
                    cmdupdate.Parameters.Add("@RepCost", SqlDbType.Money, 1000, "RepCost");
                    cmdupdate.Parameters.Add("@OrgPaymentPaid", SqlDbType.Money, 1000, "PaymentPaid");
                    cmdupdate.Parameters["@OrgPaymentPaid"].SourceVersion = DataRowVersion.Original;
                    cmdupdate.Parameters.Add("@PaymentPaid", SqlDbType.Money, 1000, "PaymentPaid");
                   
                    da_rep.UpdateCommand = cmdupdate;
                 





                    if (check == true)
                    {

                        try
                        {
                            da_rep.Update(ds_rep, "Repair");
                            ds_rep.AcceptChanges();
                        }


                        catch (Exception ex)
                        {
                            MessageBox.Show("Their is some problem in updating make sure you are entering right values                " +
                            ex);
                        }
                    }
                   
                       //}
                               
                //}
                }
           else
                {
                    MessageBox.Show("no changes made");
                }

                //int modifiedRows = da_cus.Update(myChangedDataset);
                //MessageBox.Show("Database has been updated successfully:" + no_of_rows_chang + "  rows has been changed");

        }

can any one help me

Thanks

Answers (3)