strongly-typed-dataset

Create Strongly Typed Dataset for a stored procedure that return more than one table

…衆ロ難τιáo~ 提交于 2020-03-05 06:10:22
问题 I have a stored procedure that performs 3 select. How do I create a strongly typed dataset that can access all the 3 tables and read the data. Visual studio by default generates a dataset with the 1st table only I have already tried using visual studio Typed Dataset, to drag and drop the Stored Procedure. Stored procedure is something like this: Create Procedure GetData As Begin Select ColA, ColB, ColC from TableA Select ColD, ColE, ColF from TableB Select ColG, ColH, ColI from TableC End 回答1

Nullable Int Column in DataSet

烂漫一生 提交于 2020-01-21 06:49:47
问题 I'm working with .NET strongly-typed datasets and have a table with a nullable int column (and a nullable DateTime column as well). Apparently there is a bug with the dataset designer that prevents having nullable columns on these data types. The designer only allows "throw exception" as the default behavior for null values. Unfortunately, when using a nullable data type in the database, a null value IS a legitimate value but results in a thrown exception when attempting to retrieve this

Correct parameter types for select queries that use table valued functions

可紊 提交于 2020-01-06 20:18:09
问题 My SQL Server 2012 contains a function Get_Schedule : CREATE FUNCTION Get_Schedule( @pProject_Id AS INT, @pPeriod_Start AS DATETIME2, @pPeriod_End AS DATETIME2) RETURNS TABLE WITH SCHEMABINDING AS RETURN ( SELECT 42 AS Val1, 'Foo' AS Val2); Visual Studio 2015's SQL Server Object Explorer shows the function parameters with the types as defined. However when dragging the function to the strongly typed dataset designer the DATETIME2 parameters are changed to ANSISTRING instead of System.DateTime

EnforceConstraint on Datatable

独自空忆成欢 提交于 2020-01-04 11:14:52
问题 On a dataset is a EnforceConstraints property indicating whether the constraints should be enabled. Althought a datatable also can have constraints i cannot disable the constraints for a datatable. My case is that I have datatable which i use in memory with a uniqueconstraint on one of the columns. Sometimes i want to temporarily disable the unique constraint. How can I do this? The only thing I came up with is removing and re-adding the constraint. Is there a better way? 回答1: There is no

EnforceConstraint on Datatable

自作多情 提交于 2020-01-04 11:14:11
问题 On a dataset is a EnforceConstraints property indicating whether the constraints should be enabled. Althought a datatable also can have constraints i cannot disable the constraints for a datatable. My case is that I have datatable which i use in memory with a uniqueconstraint on one of the columns. Sometimes i want to temporarily disable the unique constraint. How can I do this? The only thing I came up with is removing and re-adding the constraint. Is there a better way? 回答1: There is no

Transactions in Typed DataSets

*爱你&永不变心* 提交于 2020-01-01 05:37:07
问题 Have a typed dataset with several related tables, and relations defined between those tables. As I process a datafeed, I'm adding, modifying, and removing records, then calling update on each table. Requests Reapprovals UserRole RequestId ----- RequestId ----- RoleId Reason RoleId ----/ UserId The reason for using a typed dataset is that I have to check existing data to determine whether I'm adding, modifying, or removing records... so I need the full dump of everything I'm working with (the

Finding all DataSets on a Windows/DevX Form

旧街凉风 提交于 2019-12-25 09:29:30
问题 I would like to ask if it's possible to somehow find and list all of the DataSets that are on a Form. I could not find them in the Form Controls, they have been added via the Visual Studio form designer and there will be so many different DataSets in the software I am building that I want to write a library for their general management, but for that, I have to add them to a list somehow, and I can't find anything on this topic. List<DataSet> formSets = new List<DataSet>(); //Operation to find

Windows Forms - Validate DataGridView input

限于喜欢 提交于 2019-12-24 17:16:00
问题 I have a Windows Forms application with a DataGridView in one of the forms. The DataGridView can insert and update through a Typed Data Set generated by Visual Studio. I want to show user friendly error messages when a user doesnt fill in a required field or enters the wrong data type, etc. instead of the ugly huge one that is shown by default. This page here gives some guidance. It advises me to validate input on my data sources property setters. How can I do this with a typed dataset? I am

How to execute a custom command against a typed dataset

梦想与她 提交于 2019-12-24 16:27:52
问题 I want to execute a custom command against a typed dataset I created using the dataset designer. For this I need to get a reference to the underlying connection, right? How to go about this? In which autogenerated file can I find the connection? 回答1: You can set the ConnectionModifier property of the TableAdapter in the designer, is defaulted to Internal, so you can use it in the same project/assembly, change it to Public and use it everywhere you need it. Or a better aproach will be create a

Casting DataRow to Strongly-Typed DataRow: How do they do it?

拜拜、爱过 提交于 2019-12-24 06:40:13
问题 I'm trying to make a lightweight version of some strongly-typed DataRows in order to write a test for a method that takes IEnumerable<T> where T : DataRow . I would like to make a class that inherits from DataRow but has additional properties, as in the autogenerated strongly-typed DataSet.Designer.cs. I cannot get their code to work, and indeed I don't understand how it could work: // from AnimalDataSet.Designer.cs: [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System