How to insert data direct from datagridview to database using LINQ

  • Thread starter Thread starter How to create this functions
  • Start date Start date
H

How to create this functions

Guest
if (dgArtikujt.SelectedRows.Count >= 1)
{
decimal total = 0.0M;

for (int i = 0; i < dgArtikujt.SelectedRows.Count; i++)
{
int index = dgTavolina.Rows.Add();
dgTavolina.Rows[index].Cells["TNr"].Value = dgTavolina.RowCount;
//dgTavolina.Rows[index].Cells["TBarkodi"].Value = dgArtikujt.SelectedRows.Cells["Barkodi"].Value.ToString();
dgTavolina.Rows[index].Cells["TArtikulliID"].Value = dgArtikujt.SelectedRows.Cells["ArtikulliID"].Value.ToString();
dgTavolina.Rows[index].Cells["TEmri"].Value = dgArtikujt.SelectedRows.Cells["Emri"].Value.ToString();

dgTavolina.Rows[index].Cells["TSasia"].Value = 1.00;
dgTavolina.Rows[index].Cells["TDs"].Value = dgArtikujt.SelectedRows.Cells["Ds"].Value.ToString(); ;
dgTavolina.Rows[index].Cells["TCmimi"].Value = dgArtikujt.SelectedRows.Cells["Cmimi"].Value.ToString();
dgTavolina.Rows[index].Cells["TTVSH"].Value = dgArtikujt.SelectedRows.Cells["TVSH"].Value.ToString();
//total += fd.Cmimi.GetValueOrDefault(0) * fd.Sasia.GetValueOrDefault(0);
dgTavolina.Rows[index].Cells["TVlera"].Value =0.00 ;

;
}

//

dgTavolina.Rows[dgTavolina.Rows.Count - 1].Selected = true;
txtSearch.Text = "";
levizshiritin();
}
I have fill datagridview from another datagridview and this I will to save in database but i dont know how to do this.

Continue reading...
 
Back
Top