Click here to Skip to main content
15,921,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i am saving the grid i got the extra row as the empty string so i dont want to save that one what i have to do?
suppose i am taking i=0,i<7......so i getting empty rows also in the save section ?in windows application

C#
for (int i = 0; i < 7; i++)
{
    dgvpayscdule.Rows.Add();
    string particular = "";
    if (i == 0) particular = "On Booking : ";
    if (i == 1) particular = "On Commencement of Civil Work:";
    if (i == 2) particular = "On Casting of Basement Slab: ";
    if (i == 3) particular = "On Casting of G Floor Slab:";
    if (i == 4) particular = "On Casting of 1st Floor Slab:";
    if (i == 5) particular = "On Casting of 2nd Floor Slab: ";
    if (i == 6) particular = "On Possession: ";
    dgvpayscdule.Rows[i].Cells[1].Value = particular;
    
    
    string result_query = "";
    for (int i = 0; i < dgvpayscdule.Rows.Count; i++)
    {
        result_query += "'" + Convert.ToString(dgvpayscdule[3, i].Value) + "'" + ",";
    }
    result_query = result_query.TrimEnd(',');
    
    
    string str_query_paySchedules = "insert into AdvitPM_BookingPaymentSchedule(BookingID,CustomerId,onBooking,onCommencementofCivilWork,onCastingofBasementSlab,onCastingofGFloorSlab,onCastingofFirstFloorSlab,onCastingofsecondFloorSlab,onPossession,createddate,createdby,status)";
    str_query_paySchedules += " values(" + objbooikng.BookingID + "," + objbooikng.CustomerID + "," + result_query + ",'" + objbooikng.CreatedDate + "','" + objbooikng.CreatedBy + "','" + objbooikng.Status + "')";
    OdbcCommand cmd1 = new OdbcCommand(str_query_paySchedules, con);
    cmd1.Transaction = trans;
    cmd1.ExecuteNonQuery();
Posted
Updated 1-Oct-12 0:13am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900