eejay

eejay

  • NA
  • 5
  • 0

'System.Data.OleDb.OleDbException'

May 26 2005 12:07 PM
All, I'm getting a: 'An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll' after adding my 'phonenumber' field to: string str = string.Format("INSERT INTO Customers (firstname, lastname, address, city, state,zipcode,phonenumber) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", this.fname.Text,this.lname.Text,this.address.Text,this.city.Text,this.state.Text,this.zipcode.Text,this.phonenum.Text); OleDbCommand command = new OleDbCommand(str,conn); command.ExecuteNonQuery(); conn.Close(); The error points to line: command.ExecuteNonQuery(); If I remove phonenumber everything works fine. The database is set to accept 'Number' as the data type for this field. I should also add I'm using an Access dB. Any ideas?

Answers (4)