Click here to Skip to main content
15,921,837 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
MsSql = ""
MsSql &= "Select tsalesdump_gid,tsalesdump_date,tsalesdump_name,executivename_executive,tsalesdump_vch_no,tsalesdump_debit,tsalesdump_credit"
MsSql &= " from vsolv_tmp_tsalesdump as a"
MsSql &= " left join vsolv_trn_executivename as b on a.tsalesdump_name = b.executivename_particulars"
MsSql &= " where tsalesdump_gid = '" & lsRefid & "' and tsalesdump_isremoved = 'N'"
dtDumpBooking = Gobjdbconn.GetDataTable(MsSql)

MsSql = ""
MsSql &= " SELECT tsalesdump_date,tsalesdump_name,tsalesdump_vch_no FROM"
MsSql &= " ( SELECT tsalesdump_date,tsalesdump_name,tsalesdump_vch_no FROM vsolv_tmp_tsalesdump"
MsSql &= "  UNION"
MsSql &= " SELECT tsalesregdump_date,tsalesregdump_name,tsalesregdump_vch_no FROM vsolv_trn_tsalesregdump"
MsSql &= " ) A order by tsalesdump_vch_no asc; "
dtdumpsample = Gobjdbconn.GetDataTable(MsSql)


What I have tried:

how to variable to store in sql data

if the two sql data is same it ill be update and its not same its go to insert how can use it
asp.net vb
Posted
v2
Comments
This is not clear. Please Improve the question and add more details about the issue.

1 solution

Hi
Two ways are there to do this

1.You can use linq to get the data from datatable with your condition and store it in variable

2.You can create anonymous objects and store your data into it

C#


var obj1=new obj1
{
tsalesdumpgid=dtDumpBooking.rows[index][columnname].tostring(),
tsalesdumpname=dtDumpBooking.rows[index][columnname].tostring(),
executivenameexecutive=dtDumpBooking.rows[index][columnname].tostring()
};


var obj2=new obj2
{
tsalesdumpdate=dtdumpsample .rows[index][columnname].tostring(),
tsalesdumpname=dtdumpsample .rows[index][columnname].tostring()

};


if(obj1==obj2)
{
//your code

}

VB


Dim obj1 = New obj1() With { _
Key .tsalesdumpgid = dtDumpBooking.rows(index)(columnname).tostring(), _
Key .tsalesdumpname = dtDumpBooking.rows(index)(columnname).tostring(), _
Key .executivenameexecutive = dtDumpBooking.rows(index)(columnname).tostring() _
}



Dim obj2 = New obj2() With { _
Key .tsalesdumpdate = dtdumpsample.rows(index)(columnname).tostring(), _
Key .tsalesdumpname = dtdumpsample.rows(index)(columnname).tostring() _
}




If obj1 = obj2 Then
//your code
End If




The above code is just an example only
 
Share this answer
 
v8

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