I have a field of Issue date which takes the date of that very day when i fire the query now I want that field of Return Date in my data base should take the date while adding 14days to it?
How do i do that?

Recommended Answers

All 8 Replies

Try this,

Dim Issudate As Date
        Issudate = Date.Now
        MessageBox.Show(Issudate.AddDays(14).ToShortDateString())

Using Query

SELECT        paper_date + 5 AS [Start + 5]
FROM            TableName

Hope this will help you...

The data entry has to go into the database not message box .
How do i proceed?

Just add as,

Issudate=Issudate.AddDays(14).ToShortDateString()

now insert this variable to database

If ddlMember.SelectedIndex = "2" Then
    Dim Issudate As Date
    Dim DueDate As Date
Issudate = Date.Now DueDate = Issudate.AddDays(14).ToShortDateString()
clscommon.executeNonQuery("insert into DAV_LIB_Book_Transaction(BM_ID,BT_Issue_Dt,BT_MemberType,BT_IssuedTo,BT_Actual_Return_Dt,Active) values ('" & Trim(StrConv(txtBkId.Text, VbStrConv.ProperCase, 0)) & "','" & dt & "','" & Trim(StrConv(txtMemberId.Text, VbStrConv.ProperCase, 0)) & "','" & ddlMember.SelectedValue & "','" & dt & "',1)")


End If

i wrote this code but this doesnt work.

what is the error you have got can u explain and by the way where is the 'Issudate' check the insert query carefully.

der is no error it simply doesnt add up the date.
can u please correct the query ,re-write it and then send it?

Change dt as Issudate

clscommon.executeNonQuery("insert into DAV_LIB_Book_Transaction(BM_ID,BT_Issue_Dt,BT_MemberType,BT_IssuedTo,BT_Actual_Return_Dt,Active) values ('" & Trim(StrConv(txtBkId.Text, VbStrConv.ProperCase, 0)) & "','" & Issudate  & "','" & Trim(StrConv(txtMemberId.Text, VbStrConv.ProperCase, 0)) & "','" & ddlMember.SelectedValue & "','" & Issudate  & "',1)")

Unuserd variable dt can be replaced.

It worked
thnxs

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.