Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello
I need create form using vb.net to delete date from table sql server using date to date
thanks

What I have tried:

still learn vb.net can u help me
Posted
Updated 11-Sep-21 18:53pm
Comments
Wendelius 11-Sep-21 17:57pm    
At the moment the question does not make sense. Please use "Improve question" to explain the problem in more detail, preferably with an example.

1 solution

We can't help you with anything specific - your question is just too vague, and we have no idea where you might be stuck.

But basically, you need to issue an SQL Command using the DELETE syntax with a BETWEEN condition in the WHERE clause:
SQL
DELETE FROM MyTable WHERE myDateColumn BETWEEN startDate AND endDate

This may help:
VB
Using con As New SqlConnection(strConnect)
    con.Open()
    Using com As New SqlCommand("DELETE FROM MyTable WHERE myDateColumn BETWEEN @START AND @END", con)
        com.Parameters.AddWithValue("@START", mystartDateTime)
        com.Parameters.AddWithValue("@END", myEndDateTime)
        com.ExecuteNonQuery()
    End Using
End Using
 
Share this answer
 

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