TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kishore Patel
NA
10
529
evaluate variable values ( manipulating variables and valu )
Jun 1 2020 9:53 AM
i have 2 tables
1. report table (with fields (cols))
col1, col2, col3, col4, col5, col6, col7
values in row 1
col1 = "trx_no"
col2 = "trx_date"
col3 = "quantity"
col4 = "rate"
col4 = "quantity * rate"
col6 = "tax"
col7 = "(quantity * rate)+tax"
2. transaction table (with fields (cols))
trx_no, trx_date, quantity, rate, tax
value in row 1
trx_no = "00001"
trx_date = "01/04/2020"
quantity = 20
rate = 150
tax = 540
value in row 2
trx_no = "00002"
trx_date = "05/04/2020"
quantity = 100
rate = 110
tax = 1980
private
void
TData_Grid(
string
RMST)
{
if
(SPDConn.State != ConnectionState.Open)
// Connection can be {Open, Close, Broken, Connnecting, Executing, Fetching}
{
SPDConn.Close();
SPDConn.Open();
}
if
(SPMConn.State != ConnectionState.Open)
// Connection can be {Open, Close, Broken, Connnecting, Executing, Fetching}
{
SPMConn.Close();
SPMConn.Open();
}
string
str1 =
"select * from dbo.trxdat"
+ SPGlobal.spyear +
" where cmp_code = '"
+ SPGlobal.spcmp_code +
"' and trx_type = '"
+ RMST +
"'"
;
SqlCommand mcmd =
new
SqlCommand(str1, SPDConn);
SqlDataReader mrdr = mcmd.ExecuteReader();
string
trx_no;
DateTime trx_date;
decimal
quantity, rate, tax;
while
(mrdr.Read())
{
//transfering datatable to variables
trx_no = mrdr[
"trx_no"
].ToString();
trx_date = (DateTime)mrdr[
"trx_date"
];
quantity = (
decimal
)mrdr[
"quantity"
];
rate = (
decimal
)mrdr[
"rate"
];
tax = (
decimal
)mrdr[
"tax"
];
Console.WriteLine(col1);
Console.WriteLine(col2);
Console.WriteLine(col3);
Console.WriteLine(col4);
Console.WriteLine(col5);
Console.WriteLine(col6);
Console.WriteLine(col7);
}
mrdr.Close();
}
how do i manupulate col1, col2, col3, ...... so that at console i get
note : datatables won't change they are read only
"00001"
"01/04/2020"
20
150
3000
540
3540
Reply
Answers (
1
)
Regular Expression
Data table filled with json, jquery and webservice