spaces in SQL Server Columns (C#,VB.net)
-
Hello All!!!! I have got a problem, I have a generalized class for inserting/updating/and deleting data, here are few lines of code which work well for adding new records in database
cmdBldr = new OleDbCommandBuilder(dataAdapter); DataRow nRow = dataTable.NewRow(); nRow.ItemArray = itemArray; dataTable.Rows.Add(nRow); dataAdapter.Update(dataTable);
As command builder is used to generate the sql statements so it works well with columns names with no spaces like [FirstName], but if we make it [First Name] then it throws following exception:An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
:confused: Can anybody give me the idea that how to reslove this, i dont want to remove spaces because they coulmn names are displayed at run time on form so that if i change the name in table, it get changed on form automatically. Thanx in Advance :) sorry for my bad English. -
Hello All!!!! I have got a problem, I have a generalized class for inserting/updating/and deleting data, here are few lines of code which work well for adding new records in database
cmdBldr = new OleDbCommandBuilder(dataAdapter); DataRow nRow = dataTable.NewRow(); nRow.ItemArray = itemArray; dataTable.Rows.Add(nRow); dataAdapter.Update(dataTable);
As command builder is used to generate the sql statements so it works well with columns names with no spaces like [FirstName], but if we make it [First Name] then it throws following exception:An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
:confused: Can anybody give me the idea that how to reslove this, i dont want to remove spaces because they coulmn names are displayed at run time on form so that if i change the name in table, it get changed on form automatically. Thanx in Advance :) sorry for my bad English.