Spring Festival is relatively idle. I just learned a little about linq to SQL and plan to become a small financial system.
Coolite is used on the interface. The user experience is good. I only saw the effect. I just downloaded the control and didn't know it at all. Just learn it.
The system is used by layers, and it must be put in place on the surface.
I directly use the code generated by linq to SQL as an entity.
The problems encountered in the project are as follows:
Question 1:
When a user logs on to determine the password, if the database does not contain this record (incorrect input)
If (fdc. UserInfo. Single (c => c. UserName = name & c. PassWord = psw )! = Null)
At this time, an error is reported: The sequence does not contain any elements.
SingleOrDefault should be used
Question 2: I am killed ,?? There is a problem with the SQL statement generated from NULL to 0 in this case.
// Calculate the sum of multiple columns. Convert the NULL column to 0.
Var test = (from c in tt. cost
Select new
{
Dress = (c. living. HasValue? C. living: 0) + (c. dinner. HasValue? C. dinner: 0)
}). Sum (v => v. dress );
// This write does not generate my ideal null (XX, 0)
Select sum ([t1]. [value]) AS [value]
FROM (
SELECT (
(CASE
WHEN [t0]. [living] is not null then [t0]. [living]
ELSE @ p0
END) + (
(CASE
WHEN [t0]. [dinner] is not null then [t0]. [dinner]
ELSE @ p1
END) + (
(CASE
WHEN [t0]. [sociality] is not null then [t0]. [sociality]
ELSE @ p2
END) AS [value]
FROM [dbo]. [cost] AS [t0]
) AS [t1]
-- @ P0: Input Float (Size = 0; Prec = 0; Scale = 0) [0]
-- @ P1: Input Float (Size = 0; Prec = 0; Scale = 0) [0]
-- @ P2: Input Float (Size = 0; Prec = 0; Scale = 0) [0]
Question 3
- If the Convert. ToInt32 parameter is null, 0 is returned;
- If the int. Parse parameter is null, an exception is thrown.
- If the Convert. ToInt32 parameter is "", an exception is thrown;
- If the int. Parse parameter is "", an exception is thrown.
- Convert. ToInt32 can be converted to many types;
- Int. Parse can only convert numeric strings.
I can't remember
Question 4
Due to the stateServer mode used by the Session, objects must be serializable. The object serialization of the linq to SQL statement is problematic and will not be resolved.
Coolite is very powerful and gradually familiar
Question 5
I dynamically created some controls in the background, but I also got findControl. It turns out that every request for dynamic controls will be lost.
Therefore, you cannot place the control creation method in! In isPostback
Question 6:
SQL column-to-Row Operations
Code Declare @ SQL varchar (8000)
Set @ SQL = 'select B. username as name'
Select @ SQL = @ SQL + ', sum (case costtypeid when' + cast (id as varchar) + 'then costmoney else 0 end) ['+ typename +']'
From (select id, typename from costtype) as
Set @ SQL = @ SQL + ', date from cost a left join userinfo B on a. userinfoid = B. id group by username, date'
Print @ SQL
Exec (@ SQL)