data-access-layer

Passing comma delimited list as parameter to IN clause for db2 query using designer in visual studio 2008

我是研究僧i 提交于 2021-02-04 16:36:05
问题 I want to pass a comma delemited list of values as a parameter to a query I'm building using the designer in Visual Studio 2008 based on some strongly typed DAL tutorials I was going through. The query is going against a DB2 database. Here's what I want to do: select * from prices where customer in(?) It works fine win I pass in 123456 as ? But fails when I pass in '123456' (it is a char field so I don't know why this doesn't work; it must be adding these behind the scenes) or 123456, 123457

How to write a better data access layer with Realm

两盒软妹~` 提交于 2020-02-21 11:18:44
问题 I've been using Realm in a few small projects and I quite like it. I'm hoping to move on to using it in bigger projects and I'm looking for better structure my data access layer. I came across this similar question and tried to build up on the information I found there. The approach discussed there is the DAO pattern so I gave a shot at that. This is my model class. class Chat: Object { dynamic var id: String = "" dynamic var createdAt: Date = Date() dynamic var creatorId: String = "" dynamic

SqlDataAdapter not filling DataTable

倾然丶 夕夏残阳落幕 提交于 2020-02-08 03:14:25
问题 I am having a problem where a SqlDataAdapter is not filling a DataTable when executing a particular SQL Server stored procedure, despite the fact I have many similar functions executing almost identical stored procedures that all work correctly. Here is the function that runs the stored procedure and returns the filled DataTable ; public DataTable getAssetClassifications(int? pLevel) { // Create dataTable to hold data var dt = new DataTable(); // Initialize connection using (connection = new

SqlDataAdapter not filling DataTable

ぐ巨炮叔叔 提交于 2020-02-08 03:12:47
问题 I am having a problem where a SqlDataAdapter is not filling a DataTable when executing a particular SQL Server stored procedure, despite the fact I have many similar functions executing almost identical stored procedures that all work correctly. Here is the function that runs the stored procedure and returns the filled DataTable ; public DataTable getAssetClassifications(int? pLevel) { // Create dataTable to hold data var dt = new DataTable(); // Initialize connection using (connection = new

Settings.Designer file and Staticness

一曲冷凌霜 提交于 2020-01-24 20:16:07
问题 I have a DAL class library that is included in my program as a DLL. The below line is from the DAL to initialize the connection. DataSet ds = new DataSet("table"); SqlConnection cnn = new SqlConnection(Settings.CMOSQLConn); When I run this I get the below error: An unhandled exception of type 'System.StackOverflowException' occurred in CMO.DAL.dll The below is in the Settings.Designer.cs file and it is where it shows the error on the get call : [global::System.Configuration

Trying to understand how to abstract my data access layer

元气小坏坏 提交于 2020-01-15 10:49:16
问题 I'm writing an application that is used to catalog files, and attribute those files with meta data. A photo album program would be a good comparison to what I'm trying to do. I'm trying to abstract the interface between my program and the file system which stores the files, and the database which stores the meta data for the files. This is to allow for mocking and unit testing. In addition, I'd like to be able to create multiple implementations of my tool that can leverage different database

Using CustomPropertyTypeMap to map specific properties

雨燕双飞 提交于 2020-01-15 05:49:07
问题 I have a couple of classes that need to have one or two properties (out of several dozen) mapped to a column on a table that has a different column name. I don't want to map all of the properties, when only two differ from the column names in the database. I can't find decent docs on all of the various mapping options that can be used with the CustomPropertyTypeMap, they all just show mapping the entire object with the CustomPropertyTypeMap (as does the Dapper tests class). When I use the

Is it deemed bad practice to inject the DAO into the constructor? and if so, why?

时光怂恿深爱的人放手 提交于 2020-01-15 03:34:08
问题 I have a (DAL) Data Access Layer (but this question is relevant for DAOs as well) which is communicating with a restful web service in android (which is less relevant other than the fact that I am not wanting to include heavy restful libraries as the interaction isn't so complex). I have a object which wraps a list which is populated by information from this data access layer, as the user scans down and reaches the bottom of this list, this object retrieves another set of information from the

Is returning DataTable or DataSet from DAL is wrong approach

我只是一个虾纸丫 提交于 2020-01-14 05:43:47
问题 I am creating my assignment project from scratch, I started off by creating a DAL that handles connection to SQL and can execute stored procedure. The project later will be a CMS or Blog My DAC or DAL is reading connection string from web.config and accepting arrays of SQL Parameters along with Stored Procedure Name and is returning output of the executed stored procedure in DataTable . I am calling my DAC as follows( using class functions and sometimes using code behind) Dim dt As DataTable

Creating screens and underlying data access layer dynamically on Android

爷,独闯天下 提交于 2020-01-14 03:22:05
问题 I want to allow the user to create "custom screens" dynamically by selecting from a existing set of fields at runtime i.e., everything should be done on App on the phone. For example - existing set of fields = {name, location, picture, age} . User A wants to create a new screen with fields name, location and age. and User B wants to have a screen with only name and picture. These screens should be persistent and should be able to save, query and edit information in a local database on the