Tuesday, May 29, 2012

How to get WPF datagrid cell value

We can easily get the value of a WPF datagrid cell value using cast with the class. in which class the data grid is   bind. consider the code

 private void GetTotalGBP()  
       decimal dr = 0, cr = 0;  
      for (int i = 0; i < receiveInvoiceDataGrid.Items.Count; i++)  
          ReceiveInvoice obj = receiveInvoiceDataGrid.Items[i] as ReceiveInvoice;  
          TGBP += Convert.ToDecimal(obj.NetValue); // getting cell value  
          TQTY += Convert.ToDecimal(obj.ConfirmOrderQty); // getting cell value  
       totalGBPTextbox.Text = TGBP .ToString("F");  
       totalQtyTextBox.Text = TQTY .ToString("F");  

Friday, May 4, 2012

How to delete duplicate row from table sql

If we want to delete the duplicate row from a table we can perform it by sq l. Consider the following SQ L query

 delete from PATIENT_INFO   
 where MrNo in (select MrNo  
         from PATIENT_INFO group by MrNo  
         having (count(PatientId))>1) and   
         PatientId not in (select min(PatientId)  
              from PATIENT_INFO   
              group by MrNo  
              having (count(PatientId))>1)  

Here PATIENT_INFO    is Table Name. and PatientId  is the primary key of the table. and we want to delete the duplicate MrNo  .

SQL Get all Index create script from Database

To get all script from database as a create new index into another database you can use the following --Get all Index Script SELECT...