Alter Table Add Column

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()
 
M

Miha Markic [MVP C#]

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?
 
N

Nathan Carroll

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()
 
M

Miha Markic [MVP C#]

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()
 
N

Nathan Carroll

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()
 
P

Paul Clement

¤ 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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top