i just completed a project with linq to sql and it was my first ever project after coming out of school. it was good for me as my fi
View Complete Post
The results of our reader survey are in. This month, Howard Dierking shares the takeaways.
MSDN Magazine January 2008
Josh Trupin revs the engine to get us all ready for Windows Vista.
MSDN Magazine January 2007
The world of software development is all about milestones. At the lowest level, a programmer has to create a certain set of functions in a fixed amount of time, and is then judged on this performance.
MSDN Magazine January 2005
MSDN Magazine January 2002
Question:--------------What is the best way (best practice) to preserve my NULL SQL values in the databaseduring an insert/update operation (without receiving cast invalid errors)?Also, how to display a string 'n/a' when a sql value is NULL?
Description:----------------My project is using FormView with Edit/Insert templates and classes to represent my tables
Goals:------------Goal1....: display 'n/a' when there are NULL SQL values in the databaseSolution1: I am using ISNULL(field,'') in my store procedure for SELECT statements
Goal2....: if the fields are 'n/a', then save them back in the database as NULLSolution2: on my insert/edit methods I am having to check the values being passed, i.e:
cmd.Parameters.Add(new SqlParameter("@scope", SqlDbType.NVarChar, 50));
if (item.Scope == "n/a") cmd.Parameters["@scope"].Value = DBNull.Value;else cmd.Parameters["@scope"].Value = item.Scope;
Not to mention that for SQL DateType fields when you use ISNULL(field,'') the return string is '1/1/1900 12:00:00 AM'and I have to change the field value in every field that represents a date, i.e:
protected void FormView1_DataBound(object sender, Sy
Scenario:=========I have a Timer and a GridView which pulls the data from one SQL table every X seconds.This table has 2 fields: id (uniqueidentifier) and comments (varchar(max)) and the data changes every rapidly.
On every page refresh the whole GridView content is replaced with whatever data is in the table.So that gives me a few scenarios I can think of....for instance:
First request:ID=23FF803F-3AF0-45CA-B536-096A8E410BCD; Comments="Step 1"
Second request:ID=23FF803F-3AF0-45CA-B536-096A8E410BCD; Comments="Step 2"
Goal: I'd like to keep the previous value so that Comments="Step 1, Step 2" and so on.
Bear in mind that on a subsequent request that same ID might not exist anymore and the cached info for that ID should also be gone.
Another idea would be to have a 3rd control (i.e,Label) which would hold all the previous values. That way, the user could see the latest values in the TextBox but all the cached previous