Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi all,
I need to convert the power builder code in vb.net.
this is the power builder code
 receiptdate +" ("+Mid(Upper(dayname( receiptdate )) ,1,3)+")"
I tried to convert it like this
stringvar ReceiptDate = {DataTable1.ReceiptDate};
numbervar dayname = Mid(UpperCase(Day( {DataTable1.ReceiptDate})) ,1,3);
cstr(ReceiptDate) & cstr(dayname);
but when i want to save it in crystal report,it come out an error state that "A date is required."
Can anyone guide me how to solve it? Or is there any website that have tutorial about declaring variable in crystal report vb.net?
Posted 27-Dec-12 20:40pm
Des DC533
Edited 28-Dec-12 15:07pm
v2
Comments
Sergey Alexandrovich Kryukov at 5-Apr-13 14:50pm
   
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted on formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.
 
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
 
—SA
Des DC at 5-Apr-13 20:42pm
   
SA,
this is my first post. The time I still don't know it got comment and question button to let other know the notification. After this post only I know there can use comment and question to get notification. I will take notice afterward. Thanks for the remind.
Sergey Alexandrovich Kryukov at 5-Apr-13 20:58pm
   
No problem at all.
Thank you for understanding.
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

check datatype of field {DataTable1.ReceiptDate} it should be datetime
 
Happy Coding!
Smile | :)
  Permalink  
Comments
Aarti Meswania at 29-Dec-12 1:33am
   
if your field's datatype is not datetime then
in sql query you should convert field in datetime
 
else
 
give me an example in how your date come in report
it's format is
DD-MM-yyyy or yyyy-MM-dd or something else...
Des DC at 30-Dec-12 1:57am
   
ok.
the format is in dd-mm-yyyy.
Aarti Meswania at 30-Dec-12 7:33am
   
do like this...
 
stringvar yyear;
stringvar mmonth;
stringvar dday;
 
dday := Mid({DataTable1.ReceiptDate},1,2);
mmonth := mid({DataTable1.ReceiptDate},4,2);
yyear := right({DataTable1.ReceiptDate},4);
 
{DataTable1.ReceiptDate} + WeekdayName(DayOfWeek(Date(yyear ,mmonth, dday)))
Des DC at 30-Dec-12 23:57pm
   
sorry for late reply.
I solved the problem by editing the format of the data.
anyway thanks for your help. :)
Aarti Meswania at 31-Dec-12 0:21am
   
welcome! :)
Glad to help you! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 Gihan Liyanage 338
2 ChauhanAjay 180
3 Vinay Mistry 160
4 Sergey Alexandrovich Kryukov 138
0 Sergey Alexandrovich Kryukov 9,011
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100