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
rohit manhas
NA
25
0
convert jsp code to c#
Apr 30 2010 9:35 AM
hi i want to convert this jsp code to c#...
JSP CODE---------------
ResultSet resultset4;
try {
Statement statement1 = connection.createStatement();
String strSQL = ("SELECT * FROM IllnessMaster");
resultset4 = statement1.executeQuery(strSQL);
while(resultset4.next())
{
str2 = resultset4.getString("IllnessId");//Here getting illness ID
dd = str2.length();//taking IllnessID length
str5 = str2.substring(1,dd);//here making IllnessId into two parts. because of it contain a charactor followed by number
int f = Integer.parseInt(str5);
if (n1<f) //the variable "n1" assign higest number
n1=f;
}
--------------------------------------------------------------
I HAD TRIED BUT IT'S GIVING ERROR------
String strSQL = ("SELECT * FROM IllnessMaster");
SqlCommand cmdSql = new SqlCommand(strSQL, conn);
conn.Open();
SqlDataReader r = cmdSql.ExecuteReader();
String str2 = "";
int dd = 0;
String str5 = "";
int n1 = 0;
String str3 = "";
int flag = 0;
while (r.Read())
{
str2 = r["IllnessId"].ToString();//Here getting illness ID
MessageBox.Show("str2=",str2.ToString());
dd = str2.Length;//taking IllnessID length
MessageBox.Show("dd=", dd.ToString());
/*LINE-1*/ str5 = str2.Substring(1+dd); //here making IllnessId into two parts. because of it contain a character followed by number
MessageBox.Show("str5=", str5.ToString());
int f = Convert.ToInt32(str5);
if (n1 < f) //the variable "n1" assign higest number
n1 = f;
}
----------ERROR IN LINE-1---------------------------------------------
Exception Details: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
Reply
Answers (
1
)
crystal report
How Do I: Show MDIChild MenuStrip show on MDIParent?