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
Vaibhav Solaskar
NA
30
18.8k
there is value is no incremented in the text box
Mar 21 2016 4:57 AM
This is my code for generating roll no in pattern of
txtrollno = dropdownlist1.selectedvalue+ "00" + 1
i.e in dropdown list we can select a course id and its is start of roll no means my roll no is 306001 i.e my course id is 306
and there is no increment is done
con.Open();
a = "select count(*),Course_ID from Student_Master where Course_ID="+DropDownList3.SelectedValue +"group by Course_ID";
cmd = new SqlCommand(a,con);
try
{
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
str1=rdr.GetInt32(0).ToString();
cnt = rdr.GetInt32(0);
txtRollNo.Text = str1;
}
rdr.Close();
}
catch(Exception ex)
{
con.Close();
throw ex;
}
str1=DropDownList3.SelectedValue;
if (cnt > 0)
{
if (cnt <= 9)
newid = str1 + "00" + cnt;
else
newid = str1 + "0" + cnt;
}
else
{//--- if no records in database
str1 = DropDownList3.SelectedValue;
newid = str1 + "00" + 1;
}
if (newid != "")
txtRollNo.Text = newid;
Reply
Answers (
3
)
How to pass data from Partial view to post method in MVC4?
Object reference not set to an instance of an object