Wednesday, August 22, 2012 6:54 PM
I would like trancate table by click button. Is it possible trancate table thru VB code? If Yes, how it to do?
Wednesday, August 22, 2012 7:06 PM
Try this code
Dim query As String = "TRUNCATE TABLE TABLENAME" Using conn As New SqlClient.SqlConnection("Connection string") Dim cmd As New SqlClient.SqlCommand(query, conn) conn.Open() cmd.ExecuteNonQuery() conn.Close() End Using
Gaurav Khanna | Microsoft VB.NET MVP
- Marked As Answer by Sheldon _XiaoModerator Tuesday, September 04, 2012 9:12 AM
Tuesday, September 04, 2012 9:12 AMModerator
I am marking your issue as "Answered", if you have new findings about your issue, please let me know.
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.