Jump to content

mkdeluxe

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by mkdeluxe

  1. Thank you for your help. Meanwhile I got the error in my code. My select statement was not right. It has to be...Dim Comm as System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("DELETE FROM Tb_Table WHERE MyDate < DATEADD(mm, -6, current_timestamp)")I only deletet the star in my query and suddenly it worked...Thanks and greetingsmkdeluxe
  2. This might be the case, I'm just beginning with programming. I use Visual Studio.Net, writing in VB. And my task is to connect to my database and delete every month those entries which are older than 6 month. I got the hint to do it like the way I posted before by a member of another forum. But this might be wrong, I have no idea...If you please could help me? Does SQL have those functions like DATEADD? Or how can I solve this task?
  3. I'd like to delete records which are older than six month.I found a description, telling me to write the query like this:Try Dim Conn as System.Data.SqlClient.SqlConnection = NewSystem.Data.SqlClient.SqlConnection("data source=cen database=date;user id=...; pwd=...") Dim Comm as System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("DELETE * FROM Tb_Table WHERE MyDate < DATEADD(mm, -6, current_timestamp)") Conn.Open() Comm.ExecuteNonQuery()Catch console.WriteLine("mistake")End TryMy Application runs until Comm.ExecuteNonQuery() and then runs into the Catch-Statement. Can anybody find a mistake?
×
×
  • Create New...