Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Special characters in Field Names - Paradox Driver

34 views
Skip to first unread message

Ponder

unread,
Dec 4, 2009, 5:26:01 PM12/4/09
to
I am in the process of developing an application that will communicate with
a legacy Paradox database. The problem that I have is that the original
developer used special characters (ie. '#') in the field names. (It is not an
option to just change the field names as there are several thousand
associated Paradox script, report, and form files that access these fields)

Using the ODBC driver, I can read the table just fine, but when I try to
insert using either of the following functions, I get an error message that
the field 'REF#' (this is the actual field name) was not found.

Option1:
private void btnAdd_Click(object sender, EventArgs e)
{
OdbcConnection myConnection = new
OdbcConnection("Driver={Microsoft Paradox Driver (*.db
)};DriverID=538;Fil=Paradox 5.X;DefaultDir=\\\\1-ttcf-fs02\\sharedfiles\\CSS
Facility Data\\Reference Log;Dbq=\\\\1-ttcf-fs02\\sharedfiles\\CSS Facility
Data\\Reference Log;CollatingSequence=ASCII");
String sql = "insert into sp_refer_log ([Ref#]) values
('0000-2009-1203-003')";
OdbcCommand cmd = new OdbcCommand(sql, myConnection);
myConnection.Open();
cmd.Prepare();
cmd.ExecuteNonQuery();
myConnection.Close();
}

Option 2:

private void btnAdd_Click(object sender, EventArgs e)
{
OdbcConnection myConnection = new
OdbcConnection("Driver={Microsoft Paradox Driver (*.db
)};DriverID=538;Fil=Paradox 5.X;DefaultDir=\\\\1-ttcf-fs02\\sharedfiles\\CSS
Facility Data\\Reference Log;Dbq=\\\\1-ttcf-fs02\\sharedfiles\\CSS Facility
Data\\Reference Log;CollatingSequence=ASCII");
String sql = "insert into sp_refer_log ('Ref#') values
('0000-2009-1203-003')";
OdbcCommand cmd = new OdbcCommand(sql, myConnection);
myConnection.Open();
cmd.Prepare();
cmd.ExecuteNonQuery();
myConnection.Close();
}

Option 3:

private void btnAdd_Click(object sender, EventArgs e)
{
OdbcConnection myConnection = new
OdbcConnection("Driver={Microsoft Paradox Driver (*.db
)};DriverID=538;Fil=Paradox 5.X;DefaultDir=\\\\1-ttcf-fs02\\sharedfiles\\CSS
Facility Data\\Reference Log;Dbq=\\\\1-ttcf-fs02\\sharedfiles\\CSS Facility
Data\\Reference Log;CollatingSequence=ASCII");
String sql = "insert into sp_refer_log values
('0000-2009-1203-003','ponder','123456','12/03/2009','Test Loc','Test
Incident','Loc','Ponder','1234567','Ponder',0,0,0,0,0,0,0,0,0,'123-12345-1234-123',0,0,0,0,0,0,0,0,0,'Ponder','Ponder',0,0,0,'Test')";
OdbcCommand cmd = new OdbcCommand(sql, myConnection);
myConnection.Open();
cmd.Prepare();
cmd.ExecuteNonQuery();
myConnection.Close();
}


Any help would be much appreciated

0 new messages