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
NAVEEN KUMAR
NA
81
7.2k
I want to send datatable value from one page to 2nd in asp.net c#
Jul 19 2020 11:58 PM
I have a web project in which a 'Cart.aspx page'. In this page i stored datatable value in session variable like below:
" Session["Buyitem"]=dt; . Now i want to use this session variable value in second page 'PaymentGateway.aspx' page like below:
DataTable dt;
dt = (DataTable)Session[
"Buyitem"
];
for
(
int
i = 0; i <= dt.Rows.Count - 1; i++)
{
con =
new
SqlConnection(cons);
con.Open();
string
sql = (
"Insert into OrderDetails(OrderID,ProductName,ProductImage,Price,CustomerName,BillingAddress,OrderDate,OrderStatus)values('"
+ Session[
"OrderID"
] +
"','"
+ dt.Rows[i][
"Product_Name"
] +
"','"
+ dt.Rows[i][
"ProdImage"
] +
"','"
+ dt.Rows[i][
"ProdPrice"
] +
"','"
+ Session[
"CstmrName"
] +
"','"
+ Session[
"BillingAddress"
] +
"','"
+ Session[
"Orderdate"
] +
"','Pending')"
);
cmd =
new
SqlCommand(sql, con);
cmd.ExecuteNonQuery();
con.Close();
Session[
"Buyitem"
] =
null
;
}
but i am getting "System.NullReferenceException: 'Object reference not set to an instance of an object.'
dt was null."
Now i want to clear something:
By Cart.aspx page we redirected to Paytm gateway page and on successfull payment then redirected to PaymentGateway.aspx page .
Cart.aspx page------------------->Paytm Gateway Page-------------------------> PaymentGateway.aspx
Plz Help..
Thanks
Reply
Answers (
18
)
Store Qrcoder image in data base
How to run PHP file in asp.net contact form.