tableadapter

ADO.NET TableAdapter parameters

半腔热情 提交于 2019-12-05 06:37:40
I have a query that I wish to run through an ASP.NET TableAdapter that contains an 'IN' clause which is to receive it's values through a parameter. My question is, how do I specify this parameter? I thought of writing the conditional statement like this: AND b.group_category_id in (@ParamList) where the @ParamList is a String of the parameters, e.g. "4,12,45,23" but since the specified id is an Integer, it complains that it cannot convert String to Integer. This makes sense, but is there any way to specify such a list in a SQL statement in an ASP.NET TableAdapter? You might have a look at http

Using await with a TableAdapter

余生长醉 提交于 2019-12-04 16:01:29
I recently began using the Async CTP and while I have found it quite useful with Self Coded classes and the like, I have run into a bit of a snag when trying to implement it with Generated Code, specifically the TableAdapters that are generated when you work with a Dataset. I have an application that uses .Fill calls quite a bit to populate DataGrids and Databindings. Since .Fill blocks and my users need to be able to interact with the application while this is going on, I see the Async CTP to be an Ideal solution. Unfortunately, I cannot seem to use it with the generated TableAdpters without

Big difference in execution time of stored proc between Managment Studio and TableAdapter

可紊 提交于 2019-12-02 05:13:45
问题 How could a stored procdure run in 10 seconds via Management Studio, but take 15 minutes via a TableAdapter for the same inputs? It is repeatable, meaning I have run it at least three times in each environment, and Management Studio is consistently about 100 times faster. I'm using .net 2.0 and SQL Server 2000 In SQL Server Management, I'm executing it like this: EXEC [dbo].[uspMovesReportByRouteStep] @RouteStep = 12000, @RangeBegin = N'12/28/08', @RangeEnd = N'1/18/9' In the TableAdapter, I

Decimal passed incorrectly from C# to SQL Server with TableAdapters

耗尽温柔 提交于 2019-12-02 04:35:24
问题 Yesterday I noticed an odd behaviour when using TableAdapters, for some reason when passing a decimal < 0.1 it makes it into an integer. For example if I pass 1.0123, I can see 1.0123 in SQL Profiler, but if I pass 0.0123 I will get 123. Is there a known issue? You can do the following steps to reproduce the problem: Create a new database TestDatabase, and create the following stored procedure create proc DecimalParametersSelect ( @Foo decimal(10,5) ) as select @Foo Create a new project and

C# WinForms - how to send updates from DataGridView to DataBase

牧云@^-^@ 提交于 2019-12-02 03:14:25
问题 I have a .mdb file with a Customers table and an Agents table. The only thing that the Agents table does as yet is populate the Agent dropdown for each customer... I have a DataGridView linked to the customerBindingSource. The customerBindingSource has DataMember set to Customer and DataSource set to bindingSource1. This has the DataSource set to customerAppDS21. If I select customerAppDS21 and click Edit in DataSet Designer I can quite clearly see that there is a Customer table and Agent

Decimal passed incorrectly from C# to SQL Server with TableAdapters

人走茶凉 提交于 2019-12-02 02:35:47
Yesterday I noticed an odd behaviour when using TableAdapters, for some reason when passing a decimal < 0.1 it makes it into an integer. For example if I pass 1.0123, I can see 1.0123 in SQL Profiler, but if I pass 0.0123 I will get 123. Is there a known issue? You can do the following steps to reproduce the problem: Create a new database TestDatabase, and create the following stored procedure create proc DecimalParametersSelect ( @Foo decimal(10,5) ) as select @Foo Create a new project and add a new DataSet file SampleDataset. Add a new TableAdapter and add DecimalParametersSelect as Select

C# WinForms - how to send updates from DataGridView to DataBase

人盡茶涼 提交于 2019-12-02 02:11:37
I have a .mdb file with a Customers table and an Agents table. The only thing that the Agents table does as yet is populate the Agent dropdown for each customer... I have a DataGridView linked to the customerBindingSource. The customerBindingSource has DataMember set to Customer and DataSource set to bindingSource1. This has the DataSource set to customerAppDS21. If I select customerAppDS21 and click Edit in DataSet Designer I can quite clearly see that there is a Customer table and Agent table. These were dragged directly from the Data.mdf > Tables folder. I have been through the Configure

Big difference in execution time of stored proc between Managment Studio and TableAdapter

雨燕双飞 提交于 2019-12-02 00:45:37
How could a stored procdure run in 10 seconds via Management Studio, but take 15 minutes via a TableAdapter for the same inputs? It is repeatable, meaning I have run it at least three times in each environment, and Management Studio is consistently about 100 times faster. I'm using .net 2.0 and SQL Server 2000 In SQL Server Management, I'm executing it like this: EXEC [dbo].[uspMovesReportByRouteStep] @RouteStep = 12000, @RangeBegin = N'12/28/08', @RangeEnd = N'1/18/9' In the TableAdapter, I'm using a StoredProcedure CommandType and dbo.uspMovesReportByRouteStep for the CommandText . I'm

Passing parameter to SQL select statement IN clause acts weird.

。_饼干妹妹 提交于 2019-12-02 00:42:15
I've got the following query that returns 2 records (in DataSet's query builder) SELECT EmpID, Name, id FROM Users WHERE (CAST(id AS Varchar(20)) IN ('5688','5689')) Now if I do the same query passing the parameter instead from code behind: String param = "'5688','5689'"; it returns null. WHERE (CAST(id AS Varchar(20)) IN (@param)) I tried taking off the very first and last ', but that did not make a diffrence. !!!id is a unique PK!!! Anyone's got a clue? The solution I found is quite simple, this works like a charm and there's no need for sps or other functions; SQL: SELECT whatever FROM

Control TableAdapter Command Timeout Globally

人走茶凉 提交于 2019-11-30 15:36:58
I have a DataSet with a QueriesTableAdapter. In order to control the SqlCommand.CommandTimeout I've added a partial class called QueriesTableAdapter with a public method called ChangeTimeout. partial class QueriesTableAdapter { public void ChangeTimeout(int timeout) { foreach (System.Data.SqlClient.SqlCommand cmd in CommandCollection) { cmd.CommandTimeout = timeout; } } } For every DataSet I have that has a QueriesTableAdapter, I can set the CommandTimeout prior to executing. using (NameSpace.DataSet.DataSetTableAdapters.QueriesTableAdapter ta = new NameSpace.DataSet.DataSetTableAdapters