Question which one is used

visweswaran

New member
Joined
Jul 15, 2009
Messages
1
Programming Experience
Beginner
which is used for executing create table query whether executenonquery() or anyother command plz telllllllllll:D
 
You need to do a transaction, here's an OLE DB example:
VB.NET:
                    m_Connection = New OleDb.OleDbConnection(....)
                    Dim TheSql As String = "CREATE TABLE ....."

                    Try
                        m_Connection.Open()
                        Dim DataCommand As New OleDb.OleDbCommand
                        Dim myTrans As OleDb.OleDbTransaction

                        DataCommand.Connection = m_Connection
                        DataCommand.CommandText = TheSql

                        myTrans = m_Connection.BeginTransaction
                        DataCommand.Transaction = myTrans
                        DataCommand.ExecuteNonQuery()
                        myTrans.Commit()
                        'Was Successful
                    Catch ex As Exception
                        Throw New InvalidOperationException("Could not create the table" & Environment.NewLine & TheSql & Environment.NewLine & ex.ToString)
                        'Failed
                    Finally
                        m_Connection.Close()
                    End Try
 

Latest posts

Back
Top