>>>I am connecting to a SQL server table with a space in the table name (say, [my table]) via a CursorAdapter. How should I write the UpdateNameList property of the CursorAdapter.
>>>
>>>I tried quoting the table name with a pair of square brackets like "id [my table].id, num [may table].num". However the CursorAdapter failed to update the master table with the changes in the cursor.
>>>
>>>Any idea?
>>
>>I think here you should use the name of the cursor, not the table. Did you try that? Also, perhaps it's not too late to rename this table and remove the space?
>>
>>Read this blog post
>>
Do not use spaces or other invalid characters in your column names>
>I disagree with that post. Why would aesthetics or the perceived difficulty in reading/understanding be a factor whether to use a feature or not? What if I like to use the brackets for I like them and makes easier for ME understanding and reading the code.
For me those SQL team have made a mistake to allow any names
SELECT 4 AS [BAD+NAME],2 AS BAD,3 AS NAME
INTO #TEST
DECLARE @VAR int
SET @VAR = 2
-- you don't see difference with or without brackets
SELECT [BAD+NAME]*@VAR
-- if you forget brackets
, BAD+NAME*@VAR
FROM #TEST
-- after some time you give a difference!
SET @VAR = 3
SELECT [BAD+NAME]*@VAR
-- if you forget brackets
, BAD+NAME*@VAR
FROM #TEST
DROP TABLE #TEST
and this
SELECT 4 AS [4]
INTO #TEST
DECLARE @VAR int
SET @VAR = 2
-- now you don't see difference
SELECT [4]*@VAR
-- if you forget brackets
, 4*@VAR
FROM #TEST
-- after some time you give a difference!
SET @VAR = 4
UPDATE #TEST SET [4]=2
SELECT [4]*@VAR
-- if you forget brackets
, 4*@VAR
FROM #TEST
DROP TABLE #TEST