Mehak Daani

Greenhorn
+ Follow
since Oct 08, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mehak Daani

hey guys ...
thanx for ue suggestion....... i was getting the same problem with the prepared statement ... but the newstr.replace() function really helped ... thanx .... a lot..!!
20 years ago
JSP
Hi..
I have a text box in which the description of a problem is written .... the textbox name is prdesc ;
now when prdesc holds the value = " dont or doesnot " ... this string doesn't give a problem but if my string contains special characters such as " Don't or Doesn't or "double quotes " " ....
it gives a problem while inserting in mysql database...!!!
it checked out in the database .. it inserts a "\" before every single and double quotes...... how would i handle this in jsp ..
my insert command at the time being is
insert into some table(problem)values ('"+prdesc+"');
???

please help...
thanx
20 years ago
JSP
No replies yet ....... ???
20 years ago
Can also some one tell me ... if i have a long date ...like 2003-10-22 12:34:40 and this 2003-10-29 15:15:12...
ow can i extract just the time out of it ... and then make calulation only on the time of both the dates ..and not the dates itself ... ... .
like (15:15:12 - 12:34:40 ).....!!!
All help is appreciated ....... and plz try and include sample code ...!!!
20 years ago
Ok ... i'm posting my code ... coz nothing is to my avail... please some one help me out on this one ...!!!
Value of AttendedTo from database = 2003-10-29 15:15:12
Value of time from database =2003-10-22 12:34:40
ResultSet call_details2 = sel_name2.executeQuery(" SELECT AttendedTo -time )diffdate FROM complaints where callid = '11' ") ;
The difference that is calculated by the query is "7008072"
Then i'm taking this value to a string as getDate is not working ... it gives an error that cannot parse date ...!!!
String dd = call_details2.getString("diffdate");
My Question is how can i get the difference between the two dates in a format of "yyyy-mm-dd hh:mm:ss"
Please some one help me out on this one..!!!
Thanx in Advance..!!

I have tried to do the above in the following manner but it's not of my requirement ...
Date Attendedto = call_details.getDate("AttendedTo");
Date time - call_details.getDate("time");
The problem with above is that it returns me only the date i.e.2003-10-22 .... but i also want the time ... and i want both the date and time for calculation...!!!
Any and all ideas are welcomed ...
20 years ago
Hi all.....
I have this big confusion .... i have 2 dates of the format yyyy-mm-dd hh:mm:ss ........ now when i subtract thses dates the value that i get are really gibbrish .....
like when i subtract 2003-10-22 12:34:40and this 2003-10-29 13:15:12 the difference that i get is "7008072" ........??? y doesn't it give me 1 day..!!!
what i want the dates to do is ...
when i subtract suppose (2003-10-20 10:10:05 - 2003-10-20 08:10:05) ...
the result it should give me is
02:00:00 .... i.e. 2hrs and 0 minutes ..... and if the date is
(2003-10-25 10:10:05 - 2003-10-20 08:10:05) ...
then the result that it should give me is
05 02:00:00 ... means the time taken is 5 days and 2hrs....!!!
Please some one help me out on this one.... plz plz...!!!
Thanx
20 years ago
Ok .... I have converted the both the dates to the same format ... now how do i COMPARE them ...???
20 years ago
JSP
Hi ....
I want to calculate date difference between 2 DIFFERENT DATE FORMATS ... one of my date format is "yyyy/mm/dd" and the other date format is "yyyy/mm/dd hh:mm:ss" ............... how can i calcaulate the difference between these two dates and then display the result in a String in the format of yyyy/mm/dd ???.???
more over i want to make a comparision also ... like if(date1 > date 2) .. then i = 1 else i =0;
So i want help on 2 things .....
1. Finding difference
2. Comparing and then incrementing value of a temp variable.
plz some one help me out on this .........................
Thanx
20 years ago
JSP
THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSA AAAAAAAAAAAAAAAA LOOOOOOOOTTTTTTTT
IT WORKED ...!!
20 years ago
JSP
Hi...
I have this code where my callid is a hyper link ..... to another jsp ..... the values of the callid comes from the database .... like calls.getInt("callid)"; ...................
Now my quest is that suppose there are 5 callid ... like 1 2 3 4 5 ... when i click on the 5th callid ... i want the hyperlink to pass the value 5 to another jsp ... where i'll be executing a query based on the 5th callid .... ...
So i have 2 questions:
1. How do i pass the dynamic value through hyper link ...
2. How do i retreive that value in another Jsp.
Please help me out on this one...!!!
Thanx
:roll:
Currently my code for the callid looks like this:
<td width="8%"><a href="somepage.jsp"><%=calls.getInt("callid")%></a></font>
20 years ago
JSP
hey
thanks to all for helping me out .... now my jsp is working fine....!!!
bye.....!!!

20 years ago
JSP
Below is my full code ..... my "prioset.jsp" is calling this file. ....
all the names that u see in the while loop like txtname+i,prio+i,exp+i..are coming from the previous jsp where the name of the textbox and combo box keeps changing ........
so the txtname+i goes into the tg_date ,then the prio+i goes into the priority and the exp+i goes into the expert string ....and in my databse corresponding to each call id i have a tg_date,priority and expert coloum ....
i have removed the String[] and now i'm using vectors to store the values through the add element ..... now if i write
for(cnt=0;cnt<v_callids.size();cnt++)
{
a_call = v_callids.elementAt(cnt).toString();
a_exp= v_experts.elementAt(cnt).toString();
a_pri = v_pri.elementAt(cnt).toString();
a_date = targetdate.elementAt(cnt).toString();

}
now if i have supposing 4 records .... so for the above code .... the a_call get the 4 id's but the a_exp,a_pri,and a_date get only ONE value ..... that means that the loop iterates 4 times for the a_call but only onece for the other three ....
The reason what came into my mind was that in my for loop the vector whose size i'm taking is v_callid's and the a_call is also storing the value v_callids.elementAt(cnt) ...... so may be that's y it's get all 4 values .... coz i couldn't notice any other reason as to y it should iterate 4 times only for "a_call"....???
If any one can find any other reason do let me know ......
Now how can i iterate through all the vectors one after another .... means ..... that i want to write a loop such that it should iterate and get the first value of the callid,tg_date,pri,expert ...then update ...then iterated through the second value ... and so on ....!!!
I have tried
String date[] = request.getParameter("txtname" + i);
But it gives a conversion error
Incompatible type for =. Can't convert java.lang.String to
java.lang.String[].
Any body has ideas to solve my problem ....!!! :roll:
my code is below .... awaiting for replies .... and yeah how do i convert a string to String[]......??? is there any built in function for it ...???

<%
Class.forName("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/it_support","root","");
int i = 0;
int n =0;
int ex =0;
int p = 0;
int cnt = 0;
int c =0;

String tgdate = new String();
String tg_date = new String();
String tempdate = new String();
String temp_expert = new String();
String experts = new String();
String tempexp = new String();
String pri = new String();
String temp_pri = new String();
String priority = new String();
String callid = new String();
String temp_callid = new String();
String call_id = new String();
String a_call = new STring();
String a_exp = new STring();
String a_pri = new STring();
String a_date = new STring();


Vector targetdate = new Vector();
Vector v_expert = new Vector();
Vector v_pri = new Vector();
Vector v_callid = new Vector();
Vector v_callids = new Vector();
Statement stmt1 = conn.createStatement();
Statement uprecord = conn.createStatement();
ResultSet gtcount = stmt1.executeQuery("Select * from complaints where status =0");
while(gtcount.next())
{
i = i+1;
tgdate = request.getParameter("txtname" + i) ;
targetdate.addElement(tgdate);
temp_expert = request.getParameter("exp" + i);
v_expert.addElement(temp_expert);
pri = request.getParameter("prio" + i);
v_pri.addElement(pri);
call_id = gtcount.getString("callid");
v_callid.addElement(call_id);
}

tempdate = targetdate.toString();
n = tempdate.length()-1;
tg_date = tempdate.substring(1,n);
/*-------------------------------*/
tempexp = v_expert.toString();
ex = tempexp.length()-1;
experts = tempexp.substring(1,ex);
/*-------------------------------*/
temp_pri = v_pri.toString();
p = temp_pri.length()-1;
priority = temp_pri.substring(1,p);
/*-------------------------------*/
temp_callid = v_callid.toString();
c = temp_callid.length()-1;
callid = temp_callid.substring(1,c);
/*-------------------------------*/
v_callids.addElement(callid);
out.println("The values" + ca);
out.println("The string values" + tg_date);
out.println("Total no: of Records Retreived " + i);
out.println("The string experts" + experts);
out.println("The string priority" + priority);
out.println("-------------------------------");
out.println("The string callid " + callid);
out.println("-------------------------------");

for(cnt=0;cnt<v_callids.size();cnt++)
{
out.println("Entering in loop");
a_call = v_callids.elementAt(cnt).toString();
a_date = targetdate.elementAt(cntd).toString();
a_exp = v_expert.elementAt(cnte).toString();
a_pri = v_pri.elementAt(cntp).toString();
out.println("calls" + a_call);
out.println("-------------------------------");
out.println("a_date" + a_date);
out.println("-------------------------------");
out.println("exp" + a_exp);
out.println("-------------------------------");
out.println("pri" + a_pri);
}

%>
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>
20 years ago
JSP
Hi praful....
I tried the code that u had posted.. but now it gives the error :
Incompatible type for =. Can't convert java.lang.String to
java.lang.String[].

......
20 years ago
JSP
Hi....
Can any one help me out on this ...
i have 10 different data in 10 different textboxes/combo boxes..... now i want to "update" the database with the data that is there in the fields through ONE update button .....
So its like i have a unique id field ... as IdNumber .... and for these idnumber i'm entering values in the text box as well as combo boxes....
if there would be only one text box called date and one combo box named class then my update statement would be ...
(Update <tablename> set date = '"+date+"',class ='"+class+"' where idnumber = '"+idNumber+"')
but now the problem is that i have more than 1 data for both the date textbox and class combo box ... so how would i go bout the updating of the records ......
Example
IDnumber :123,124,125,126
TextboxDate : 2003-10-15 ,2003-20-10 ,2003-09-03 .
ClassCombobox abc, def,ghi
So in the database it would be updating the coloum date and class for the IDNUMBER 123 where the date feild would be updated with the value 2003-10-15 and the class field will be updated with the value abc ... then for the IDNUMBER 124 the date field will be updated with the value 2003-20-10 and the class field will be updated with the value "def" and so on ...
so that means that for each idnumber i have to update the database date feild and combo box .... how would i do that .....
plz keep in mind that all this has to be done ... on ONE sumbit button/update button which calls another jsp ......
Retreiving the values is not a problem ... updating the values corresponding to the idnumber is a problem ....
Plz if any one else can help .... i would be very thankful
If possible ..... please try and include a sample code
Thanxsssss
:roll:
20 years ago
JSP
hi...
thanz maulin ..... for sharing ur idea with me ... ....
But can u help me out on one more thing.... now that u can see i have 10 different data in these 10 textboxes ..... now i want to update all the 10 textboxes through ONE update button .....
So its like i have a unique id field ... as IdNumber .... and for these idnumber i'm entering values in the text box as well as combo boxes....
if there would be only one text box called date and one combo box named class then my update statement would be ...
(Update <tablename> set date = '"+date+"',class ='"+class+"' where idnumber = '"+idNumber+"')
but now the problem is that i have more than 1 data for both the date textbox and class combo box ... so how would i go bout the updating of the records ......
Example
IDnumber TextboxDate ClassCombobox
123 2003-10-15 abc
124 2003-20-10 fff
128 2003-09-03 kkk
so now ..... for each idnumber i have to update the database with the date feild and combo box .... how would i do that .....
plz keep in mind that all this has to be done ... on one sumbit button/update button which calls another jsp ......
now retreiving the values is not a problem ... updating the values corresponding to the idnumber is a problem ....

I hope u have got the idea .....!!!
Plz if any one else can help .... i would be very thankful
If possible ..... please try and include a sample code
Thanxsssss
20 years ago
JSP