Configure DataAdapter Changes the Name of a Column in Insert Command

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a SQLDataAdapter that I allow the Configuration Wizard to auto-configure the Select, Insert and Delete commands. During the configuration wizard the Select Statement that I cause to be created is simple: SELECT [ICD-9], Category, Description FROM [ICD-9] ORDER BY [ICD-9].

However, the Insert statement that is created is : INSERT INTO [ICD-9] ([ICD-9], Category, Description) VALUES (@Param1, @Category, @Description);

Look at the VALUES. Instead of the first parameter being @ICD_9, it's changed to @Param1. Now believe it or not, the statement works OK but I have no idea where @Param1 comes from and I certainly don't set a value for @Param1.

Why did the configuration wizard change the name of the first column to @Param1 instead of using the @ICD_9 the way that I expected. Is it that pesky hyphen in the column name that I never should have placed in a column name in the first place?
 
Hi Michael,

Thank you for posting in the community!

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know why the DataAdapter
configuration wizard generates the parameter name as "@Param1" for the
first column. If there is any misunderstanding, please feel free to let me
know.

As the first column name is "IDC-9", and '-' is a reserved character in
SQL, we cannot use "@IDC-9" as the parameter name. So the wizard generate a
parameter name as "@Param1" automatically. For more information, please
check the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8
_con_03_89rn.asp

Does this answer your question? If anything is unclear, please feel free to
reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top