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
pratik pangire
NA
32
14.2k
Error: There is no row at position 0
Jun 21 2018 1:44 AM
HI, i am currently working on a project, when i run the program, there is an error showing on button click event It says this:
Exception Details: System.IndexOutOfRangeException: There is no row at position 0.
protected
void
btnAddCart_Click(
object
sender, EventArgs e)
{
if
(Session[
"Mycart"
] ==
null
)
{
ShoppingCart Mycart =
new
ShoppingCart();
Session[
"Mycart"
] = Mycart;
}
string
Id = Request.QueryString[
"BookID"
];
Mycart =(ShoppingCart)Session[
"New"
];
String Query =
"select * from BookData where BookID= '"
+ Id +
"'"
;
SqlCommand cmd =
new
SqlCommand(Query, con);
SqlDataAdapter Da =
new
SqlDataAdapter(cmd);
DataTable Dt =
new
DataTable();
Da.Fill(Dt);
DataRow row = Dt.Rows[0];
Mycart.Insert(
new
CartItem(Int32.Parse(Id),
row[
"name"
].ToString(),
row[
"author"
].ToString(),
int
.Parse(row[
"isbn"
].ToString()),
row[
"language"
].ToString(),
row[
"publisher"
].ToString(),
row[
"Summary"
].ToString(),
Double.Parse(row[
"price"
].ToString()),
1)
);
}
Please reply fast, its very urgent
thank you.
Reply
Answers (
7
)
Adress Lookup in asp.met(c#)
Can any one guide me how do i implement identity in mvc