The C# types are just aliases for the .NET equivalents; so long === System.Int64, etc.
I suspect the documentation is probably wrong, and the DATA_TYPE column is most likely an Int32, which can then be cast to an OleDbType value. Check the value returned by table.Columns["DATA_TYPE"].DataType to see what it's defined as.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I'm not sure I understand that because I I really struggled with trying to get the Int64 to cast to long.
It *may* have been that I was getting DBNull back for value types out of SQL Server, which causes an exception. I left the explicit cases in my code just because I'm afraid of breaking it and I have moved on to something else, finally.
I appreciate your help and will exclude the explicit casts the next time I need to get the values form a database in some code that I feel more comfortable with. This code includes a ton of other C# constructs that are new to me, which lead to a pretty terrible debugging experience.
The lack of surety in programming is part of the reason software is fragile.
Parent & child relationship currently captured in tblCGs and tbcs tables. The MasterClient are held in tblCGs table while Children are stored in tblCs tables using tblCGs. GroupMasterCustKey as key and CustomerKey as Child key.
• Currently a tblCGs table allows the linking of Parent using (GroupMasterCustKey) to child tblcs - (CustomerKey) table which may or may not exist.
AssociatedClient Field in the tblcs table: These are related clients without any hierarchical relationship.
• Currently the AssociatedClient on the tblCs table is too limiting varchar(20) and
can have implications or cause issues.
• To Implement a new table structure where individual rows such as MIND227 - MIND227(customer ranges) are retrieved from the table rather than IND227 - IND229
• Move the Associatedclients Field in tblcs into a separate table with the following fields (ID, ClientID1, ClientID2..... , ClientRelationshipReasonID, and CreatedDate)
Please see the sample code below
IF OBJECT_ID('tempdb..#tblCGs') IS NOT NULL DROP TABLE #tblCGs
IF OBJECT_ID('tempdb..#tblCs') IS NOT NULL DROP TABLE #tblCs
--Create ClientGroups table.
CREATE TABLE #tblCGs
[GroupID] int NOT NULL, ---- IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[GroupMasterCustKey] varchar(100) NOT NULL, ---[MasterCAN]
[GroupFromCustKey] varchar(100) NOT NULL, --- CONSTRAINT [DF_tblCGs_GroupFromCustKey] DEFAULT (' '),
[GroupToCustKey] varchar(100) NOT NULL -- CONSTRAINT [DF_tblCGs_GroupToCustKey] DEFAULT (' '),
-- Populate the table with values.
INSERT INTO #tblCGs VALUES
(988, N'MIN036', N'MIND227', N'MIND229')
, (668, N'08035635', N'31036422', N'31036422')
,(669, N'08035635', N'31035623', N'31035623')
-- Create Customer table.
CREATE TABLE #tblCs ---Customers
([CustomerID] int not null ------IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
,[CustomerKey] varchar(100) NOT NULL --- [ChildCAN]
,[CompanyName] varchar(300) NULL
--Populate the table with values.
INSERT INTO #tblCs VALUES
(72894, N'MIND227', N'MIND Mind in Haringey', N'MIN036','2011-11-16 00:00:00.000')
,(93469, N'MIND228', N'Caerphilly Borough Mind', N'MIN036','2014-03-08 00:00:00.000')
,(98199, N'MIND229', N'Brecon and District Mind', N'MIN036,BDC004,POW044','2014-11-26 00:00:00.000')
,(61705, N'31036422', N'Revive', N'Null','2010-04-01 09:13:10.550')
,(61729, N'31035623', N'Jysk Ltd', N'Null','2010-04-01 12:56:16.837')
--- Current Queries
FROM #tblCGs AS CG
INNER JOIN #tblCs AS C
ON C.CustomerKey >= CG.GroupFromCustKey
AND C.CustomerKey <= CG.GroupToCustKey
The desired output should like this and not output of the above query
ID ClientID1 ClientID2 ReasonTypeID
1 201 301 1
2 201 302 1
3 201 303 1
4 303 401 1
5 601 701 3
I have a new product must be cloud over an internet and we need to choose the best database for this issue from the pricing and performance issues.
we need to know the best for this, is it the Microsoft SQL Server or the PostgreSQL.
(SQL Server VS PostgreSQL).
also I need the best tutorial and videos about the PostgreSQL database.
Please Help me ASAP.
Performance from any database will vary greatly based on what the actual use case is. If you're looking to warehouse data the "best" product will be very different than if you need a speedy cache, for instance.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
This site is not associated with such things: they are a deliberate distortion of statistics designed to fool users into thinking a site is more popular than it is.
Go to google, and try there: Buying of referrals - Google Search[^]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
For many years, I have been successfully using MS Access VBA to import data from a Sybase ASE server through direct queries. Several years ago, it was necessary to locate and install new drivers when I upgraded from XP to Win7 64-bit. All was working well until I got a new Win10 PC. I fought with installing the same drivers I used with the Win7 machine but was finally able to make a successful connection. The recordsets that are returned contain empty character fields. Numeric and date fields display fine.
I tried different values for the CharacterSet parameter in the connection string but it made no difference. I also googled... There was some information regarding empty strings for formatting purposes but none that I found that would explain the above results.I can't figure out why only char fields are affected. I would expect all or nothing if it were a driver issue but the same drivers work in Win7.
Well, It appears as if it is a driver compatibility issue. I downloaded the Devart driver and string fields are returned as expected. Further research shows that there are newer drivers in the SDK but it is no longer available to common folks like myself. I suppose I will have to weigh the cost of a third party driver versus redesigning and distributing the app. Unless anyone knows an alternate location for ASE drivers compatible with Windows 10??
First please excuse my bad english. As you can asume it's not my native language....
I'm using SQL Server Compact Edition and Visual Basic 2015 and i did a few programs with SQL-Databas-Access so far.
This programs where quite simple. They read the whole table at the beginning into a Dataset, work with this and write it back when the application is closed.
Now i need some more secure access and found some information that it's better to cut the database Acces from the gui and the business logic - all three called layer.
What i need or what i'm asking for is a small sample application with just one Database-Table - let's name it "Persons" with the fiels "Person-Id" (the key), "Person-Firstname", "Person-Lastname", "Person-DateOfBirth".
GUI should have separate fields for each of the given fields.
Acces should be Record by Record. (Input the Id, if exist show the related data in the gui, if not show empty fields, with a save button to change values / write the changes to tha database.)
Business logic may just check if the DateOfBirth is in a range from 1.1.1900 to 31.12.2099.
How should my class look like to build all three layers?
Maybe this is to much described in detail...
I just want to see a class representing all 3 layers to handle some persons data ...
Is this possible? Whould someone be so kind? This would help me so much in understanding!!!
I think you have misunderstood a little how the three-tier model works.
You don't need to re-invent your model for each tier. There are different approaches on how to handle this, but most modern approaches are based on the Model-View-Something(MV*) architecture (MVC, MVVM, MVP...there seem to be new ones daily).
Each of these map to the three-tier architecture in slightly different ways, but there are consistent points. A Model is a an object that is solely a data container. It should implement no business logic, and in your case will represent a single record from the database. It's basically just a data container.
The other consistent element is the View, or UI. Any UI interaction logic should live here, to include wiring for UI event handlers and any UI-specific logic. This is where it can become easy to get lost and break the pattern, but play with it a little and you'll start to get it.
The last part of the MV* architecture is how the business layer is implemented. Ideally, the business layer should server as an intermediary between the DAL and the UI, and depending on implementation there can be a varying level of success with that.
I suggest you have a look around at some resources regarding these patterns; there is a lot available. Which one you start with depends a lot on what sort of applications you are writing: web apps almost invariably fall to the MVC side while Windows desktop apps generally end up in an MVVM world. Just don't let yourself get confused by MVC.NET, that's a specific implementation from MicroSoft.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli