Alter Table Add Column

  • Thread starter Thread starter Nathan Carroll
  • Start date Start date
N

Nathan Carroll

Trying to implement this for an Access.mdb file. It worked on development
machine but failed on two user machines.


Dim alter As OleDb.OleDbCommand
daConn.Open()
alter = New OleDb.OleDbCommand("ALTER TABLE BillableTimesheet ADD COLUMN
Submitted BIT", daConn)
Try
alter.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
daConn.Close()
 
Hi Nathan,

What kind of application is this?
Is the Access version the same on all machines?
Does your application have enough privileges on database?
What does error say?
 
VB.net app.
The file is Access 2000 on all machines.
Not sure
Error says: Application has generated an exception that could not be
handled.
and it give thread and process id


Miha Markic said:
Hi Nathan,

What kind of application is this?
Is the Access version the same on all machines?
Does your application have enough privileges on database?
What does error say?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Nathan Carroll said:
Trying to implement this for an Access.mdb file. It worked on development
machine but failed on two user machines.


Dim alter As OleDb.OleDbCommand
daConn.Open()
alter = New OleDb.OleDbCommand("ALTER TABLE BillableTimesheet ADD COLUMN
Submitted BIT", daConn)
Try
alter.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
daConn.Close()
 
Check the InnerException property.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Nathan Carroll said:
VB.net app.
The file is Access 2000 on all machines.
Not sure
Error says: Application has generated an exception that could not be
handled.
and it give thread and process id


Miha Markic said:
Hi Nathan,

What kind of application is this?
Is the Access version the same on all machines?
Does your application have enough privileges on database?
What does error say?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Nathan Carroll said:
Trying to implement this for an Access.mdb file. It worked on development
machine but failed on two user machines.


Dim alter As OleDb.OleDbCommand
daConn.Open()
alter = New OleDb.OleDbCommand("ALTER TABLE BillableTimesheet ADD
COLUMN
Submitted BIT", daConn)
Try
alter.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
daConn.Close()
 
InnerException gives the same inablility to handle error response.

Miha Markic said:
Check the InnerException property.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Nathan Carroll said:
VB.net app.
The file is Access 2000 on all machines.
Not sure
Error says: Application has generated an exception that could not be
handled.
and it give thread and process id


Miha Markic said:
Hi Nathan,

What kind of application is this?
Is the Access version the same on all machines?
Does your application have enough privileges on database?
What does error say?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Trying to implement this for an Access.mdb file. It worked on development
machine but failed on two user machines.


Dim alter As OleDb.OleDbCommand
daConn.Open()
alter = New OleDb.OleDbCommand("ALTER TABLE BillableTimesheet ADD
COLUMN
Submitted BIT", daConn)
Try
alter.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
daConn.Close()
 
¤ Trying to implement this for an Access.mdb file. It worked on development
¤ machine but failed on two user machines.
¤
¤
¤ Dim alter As OleDb.OleDbCommand
¤ daConn.Open()
¤ alter = New OleDb.OleDbCommand("ALTER TABLE BillableTimesheet ADD COLUMN
¤ Submitted BIT", daConn)
¤ Try
¤ alter.ExecuteNonQuery()
¤ Catch ex As Exception
¤ MessageBox.Show(ex.Message)
¤ End Try
¤ daConn.Close()
¤

Have you tried using the Access DDL keyword YESNO instead of BIT?

Does the code fail if you attempt to add a different data type (such as TEXT)?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top