truncate table by VB code
-
Wednesday, August 22, 2012 6:54 PM
Hi All.
I would like trancate table by click button. Is it possible trancate table thru VB code? If Yes, how it to do?
Thanks.
All Replies
-
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
Hi eugzl,
I am marking your issue as "Answered", if you have new findings about your issue, please let me know.Best regards,
Sheldon _Xiao[MSFT]
MSDN Community Support | Feedback to us
Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

