Hello,
I read thread 796-1350501 and I realize that truncate is dangerous. That being said it also cleans out and resets the table.
I need to do a truncate a table, having used ADODB in the past, I would like to be able to do it with the SQL connection (System.Data.SqlClient).
The old code is:
The SQL connection:
I know how to do the delete but I want to do a truncate. Is it possible? If so how?
Thank you,
djj
I read thread 796-1350501 and I realize that truncate is dangerous. That being said it also cleans out and resets the table.
I need to do a truncate a table, having used ADODB in the past, I would like to be able to do it with the SQL connection (System.Data.SqlClient).
The old code is:
Code:
Dim rs As New ADODB.Recordset
Dim DBCONN As New ADODB.Connection
Dim CONNSTRING As String = "DSN=MySQL;"
DBCONN.Open(CONNSTRING)
rs = DBCONN.Execute("TRUNCATE TABLE MyTable;")
…
The SQL connection:
Code:
Dim SQLConn As New SqlConnection("Persist Security Info=False;Integrated Security=SSPI;" & _
"database=MySQLDB;server=MyServer;Connect Timeout=30")
Dim daSQL As New SqlDataAdapter("SELECT * FROM MyTable", SQLConn)
I know how to do the delete but I want to do a truncate. Is it possible? If so how?
Thank you,
djj