Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem in Altering a dbf table , table corrupts

Problem in Altering a dbf table , table corrupts

Scheduled Pinned Locked Moved C#
securityhelpcsharpdatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rudra083
    wrote on last edited by
    #1

    Dear all, I am using C# to alter a DBF file , Foxpro driver downloaded ,Everything working fine but after running alter query whole DBF format gets corrupted. And I am not able to open it again. I am adding the code snippet below.Do help me in this regard public void Alter_table() { try { string strConnect; strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source='d:\\22.dbf';Provider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Exclusive;Extended Properties=;Encrypt Password=False"; OleDbConnection dconn=new OleDbConnection(); dconn.ConnectionString = strConnect; dconn.Open(); OleDbCommand mycmd=new OleDbCommand(); OleDbCommand myCmd = new OleDbCommand("ALTER TABLE 22.dbf ADD COLUMN TEST1 c(10) NULL", dconn); myCmd.ExecuteNonQuery(); } catch(OleDbException ex) { MessageBox.Show(ex.Message); } } Thanks for any kind of help hi it is rudara

    E 1 Reply Last reply
    0
    • R rudra083

      Dear all, I am using C# to alter a DBF file , Foxpro driver downloaded ,Everything working fine but after running alter query whole DBF format gets corrupted. And I am not able to open it again. I am adding the code snippet below.Do help me in this regard public void Alter_table() { try { string strConnect; strConnect="User ID=;DSN=;Collating Sequence=MACHINE;Data Source='d:\\22.dbf';Provider=VFPOLEDB.1;Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Exclusive;Extended Properties=;Encrypt Password=False"; OleDbConnection dconn=new OleDbConnection(); dconn.ConnectionString = strConnect; dconn.Open(); OleDbCommand mycmd=new OleDbCommand(); OleDbCommand myCmd = new OleDbCommand("ALTER TABLE 22.dbf ADD COLUMN TEST1 c(10) NULL", dconn); myCmd.ExecuteNonQuery(); } catch(OleDbException ex) { MessageBox.Show(ex.Message); } } Thanks for any kind of help hi it is rudara

      E Offline
      E Offline
      esjq
      wrote on last edited by
      #2

      I've never worked with FoxPro, but to me it seems odd to specify the name of the database file (22.dbf) in an alter table statement. Shouldn't it be the name of the table you want to modify, like: ALTER TABLE TEST ADD COLUMN TEST1 c(10) NULL

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups