Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Updated 28-Dec-12 15:07pm
v2
Comments
Sergey Alexandrovich Kryukov 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 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 5-Apr-13 20:58pm    
No problem at all.
Thank you for understanding.
—SA

1 solution

check datatype of field {DataTable1.ReceiptDate} it should be datetime

Happy Coding!
:)
 
Share this answer
 
Comments
Aarti Meswania 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 30-Dec-12 1:57am    
ok.
the format is in dd-mm-yyyy.
Aarti Meswania 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 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900