﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Column Names with Hyphens and Pound Signs cause ISDataSource Command Errors</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-Names-with-Hyphens-and-Pound-Signs-cause-ISDataSource-Command-Errors/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Column Names with Hyphens and Pound Signs cause ISDataSource Command Errors</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-Names-with-Hyphens-and-Pound-Signs-cause-ISDataSource-Command-Errors/</link><pubDate>Wed, 31 Mar 2010 02:56:19 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;As a workaround, you will need to use a column name alias for such column in the SQL command in order for the table adapter generated parameter and WebGrid generated parameter to match.&lt;/p&gt;&lt;p&gt; Another suggestion, would be to convert the parameter to the expected value in the ISDS during deleting and editing server side event. Here is the snippet for the Deleting scenario.&lt;/p&gt;
&lt;p&gt;ISDS Deleting server side event for # character:&lt;/p&gt;&lt;pre&gt;protected void ISDataSource1_Deleting(object sender, ISNet.WebUI.DataSource.ISDataSourceMethodEventArgs e)&lt;br /&gt;{&lt;br /&gt;    e.InputParameters["_Original_Category_"] = e.InputParameters["Original_Category#"];&lt;br /&gt;    e.InputParameters.Remove("Original_Category#");&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;ISDS Delete Parameter for # character:&lt;/p&gt;&lt;pre&gt;&amp;lt;ISDataSource:ISDataSourceTable DeleteMethod="Delete" InsertMethod="Insert" &lt;br /&gt;    OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" &lt;br /&gt;    TableName="CategoriesPoundSign" &lt;br /&gt;    TypeName="CategoriesPoundSignTableAdapters.CategoriesPoundSignTableAdapter" &lt;br /&gt;    UpdateMethod="Update"&amp;gt;&lt;br /&gt;    &amp;lt;DeleteParameters&amp;gt;&lt;br /&gt;        &amp;lt;asp:Parameter Name="_Original_Category_" Type="Int32" /&amp;gt;&lt;br /&gt;        &amp;lt;asp:Parameter Name="Original_Category#" Type="Int32" /&amp;gt;&lt;br /&gt;    &amp;lt;/DeleteParameters&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Column Names with Hyphens and Pound Signs cause ISDataSource Command Errors</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-Names-with-Hyphens-and-Pound-Signs-cause-ISDataSource-Command-Errors/</link><pubDate>Tue, 30 Mar 2010 07:14:04 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;So, how do I get these types of tables to work with WebGrid?&lt;/p&gt;</description></item><item><title>Column Names with Hyphens and Pound Signs cause ISDataSource Command Errors</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-Names-with-Hyphens-and-Pound-Signs-cause-ISDataSource-Command-Errors/</link><pubDate>Tue, 30 Mar 2010 03:11:51 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;The cause of this issue is .NET TableAdapter limitation. The database field name will be converted in command parameter, since .NET parameter name will not accept # or - character, the parameter will be renamed, in your scenario from Original_Category# to _Original_Category_ and Category-Name to p1.&lt;/p&gt;&lt;p&gt;Similar behavior could also be observed if you are using ObjectDataSource and GridView.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Column Names with Hyphens and Pound Signs cause ISDataSource Command Errors</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Column-Names-with-Hyphens-and-Pound-Signs-cause-ISDataSource-Command-Errors/</link><pubDate>Mon, 29 Mar 2010 12:15:08 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Column Names with Hyphens and Pound Signs cause "ISDataSource '...' Table [...] could not find a non-generic method '...' that has parameters: ..."&lt;/p&gt;
&lt;p&gt;Why is this occurring?&lt;/p&gt;
&lt;p&gt;I have include T-SQL to create 2 tables in the NorthWind Database, CategoriesPoundSign and CategoriesHyphen and provided 2 Test Cases.&lt;/p&gt;&lt;pre&gt;USE [Northwind]

GO

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[CategoriesPoundSign](

[Category#] [int] IDENTITY(1,1) NOT NULL,

[CategoryName] [nvarchar](15) NOT NULL,

[Description] [ntext] NULL,

[Picture] [image] NULL,

CONSTRAINT [PK_CategoriesPoundSign] PRIMARY KEY CLUSTERED 

(

[Category#] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO


&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;&lt;pre&gt;USE [Northwind]

GO

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[CategoriesHyphen](

[CategoryID] [int] IDENTITY(1,1) NOT NULL,

[Category-Name] [nvarchar](15) NOT NULL,

[Description] [ntext] NULL,

[Picture] [image] NULL,

CONSTRAINT [PK_CategoriesHyphen] PRIMARY KEY CLUSTERED 

(

[CategoryID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;
&lt;p&gt;TEST 1:&lt;/p&gt;
&lt;p&gt;Create a DataSet (.xsd) for CategoriesPoundSign, CategoriesPoundSign&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;1. Select each row individually, do not select "*".  This will generate:&lt;/p&gt;
&lt;p&gt;SELECT Category#, CategoryName, Description, Picture FROM dbo.CategoriesPoundSign&lt;/p&gt;
&lt;p&gt;2. When configuring the TableAdapter, the first step has has an Advanced Option Button in the Lower Left&lt;br /&gt; &lt;br /&gt;- Click it and Check "Refresh the data table"&lt;br /&gt; &lt;br /&gt;3. Make sure the AutoIncrement Values are correct&lt;br /&gt; &lt;br /&gt;- Select Primary Key&lt;br /&gt; &lt;br /&gt;Change following properties form -1&lt;br /&gt; &lt;br /&gt;AutoIncrementSeed to 0&lt;br /&gt;AutoIncrementStep to 1&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Create a new .aspx page, CategoriesPoundSignISDataSource.aspx.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;4. In Design Mode, add an ISDataSource&lt;/p&gt;
&lt;p&gt;5. Configure DataSource&lt;/p&gt;
&lt;p&gt;6. Select Schema CategoriesPoundSign&lt;/p&gt;
&lt;p&gt;7. "Auto generate ISDataSource's table list from selected schema"&lt;/p&gt;
&lt;p&gt;8. Add a WebGrid&lt;/p&gt;
&lt;p&gt;9. Choose Data Source ISDataSource1&lt;/p&gt;
&lt;p&gt;10. Allow Add New&lt;/p&gt;
&lt;p&gt;11. Allow Editing&lt;/p&gt;
&lt;p&gt;12. Allow Delete&lt;/p&gt;
&lt;p&gt;13. Run the Page&lt;/p&gt;
&lt;p&gt;14. Add a New Row with Values&lt;/p&gt;
&lt;p&gt;- Category-Name = "Cat1"&lt;br /&gt;- Description = "Desc1"&lt;/p&gt;
&lt;p&gt;15. Refresh the Grid&lt;/p&gt;
&lt;p&gt;16. Edit the Description Value to be "Desc1x"&lt;/p&gt;
&lt;p&gt;17. Update the Row&lt;/p&gt;
&lt;p&gt;18. The following error is generated:&lt;/p&gt;
&lt;p&gt;"ISDataSource 'ISDataSource1' Table [CategoriesPoundSign] could not find a non-generic method 'Update' that has parameters: CategoryName, Description, Picture, _Original_Category_, Category_, Original_Category#."&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Similar problems occur with the other Commands.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;TEST 2:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Create a DataSet (.xsd) for CategoriesHyphen, CategoriesHyphen&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;19. Select each row individually, do not select "*".  This will generate:&lt;/p&gt;
&lt;p&gt;SELECT CategoryID, [Category-Name], Description, Picture FROM dbo.CategoriesHyphen&lt;/p&gt;
&lt;p&gt;20. When configuring the TableAdapter, the first step has has an Advanced Option Button in the Lower Left&lt;br /&gt; &lt;br /&gt;- Click it and Check "Refresh the data table"&lt;br /&gt; &lt;br /&gt;21. Make sure the AutoIncrement Values are correct&lt;br /&gt; &lt;br /&gt;- Select Primary Key&lt;br /&gt; &lt;br /&gt;Change following properties form -1&lt;br /&gt; &lt;br /&gt;AutoIncrementSeed to 0&lt;br /&gt;AutoIncrementStep to 1&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Create a new .aspx page, CategoriesHyphenISDataSource.aspx.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;22. In Design Mode, add an ISDataSource&lt;/p&gt;
&lt;p&gt;23. Configure DataSource&lt;/p&gt;
&lt;p&gt;24. Select Schema CategoriesHyphen&lt;/p&gt;
&lt;p&gt;25. "Auto generate ISDataSource's table list from selected schema"&lt;/p&gt;
&lt;p&gt;26. Add a WebGrid&lt;/p&gt;
&lt;p&gt;27. Choose Data Source ISDataSource1&lt;/p&gt;
&lt;p&gt;28. Allow Add New&lt;/p&gt;
&lt;p&gt;29. Allow Editing&lt;/p&gt;
&lt;p&gt;30. Allow Delete&lt;/p&gt;
&lt;p&gt;31. Run the Page&lt;/p&gt;
&lt;p&gt;32. Add a New Row with Values&lt;/p&gt;
&lt;p&gt;- Category-Name = "Cat2"&lt;br /&gt;- Description = "Desc2"&lt;/p&gt;
&lt;p&gt;32. The following error is generated:&lt;/p&gt;
&lt;p&gt;"ISDataSource 'ISDataSource1' Table [CategoriesHyphen] could not find a non-generic method 'Insert' that has parameters: p1, Description, Picture, Category-Name."&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Similar problems occur with the other Commands.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>