Some day I will know everything. I hope that day never comes.
Sometimes you need to display the variable value in the currency format. You can easily convert your values to the currently format using only 1 line of code.
double currency = 345566767;
Today is the first day of classes. I wished classes started little more late then in August. But anyway this is my last semester hopefully. Many things need to be done like finding a job, finding an apartment, buying a car.
I just hope this semester goes by smoothly. Actually my class is going on right now ahhh but I am not in a mood to go on first day.
I was having trouble exporting Datagrid to Excel because it contained paging and sorting links. If you try to export with linkbuttons a runtime error will be thrown. I found this cool article which resolves this problem. Check it out Exporting Datagrid to Excel For Datagrid formatting issues view my article: Exporting Datagrid to Excel ......
I just wrote this small SPROC which builds the list of email address and separates them with a comma. CREATE PROCEDURE [usp_GetEmailList] @EmailList nvarchar(200) OUTPUT AS DECLARE @Email nvarchar(50) --DECLARE @EmailList nvarchar(200) SET @EmailList = '' DECLARE Email_Cursor CURSOR FOR SELECT Email FROM tblPerson OPEN Email_Cursor FETCH NEXT FROM Email_Cursor WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM Email_Cursor INTO @Email SET @EmailList = @EmailList + @Email + ',' END SET @EmailList = SUBSTRING(@EmailList,0,LEN(... ......
Just like temporary tables in SQL SERVER 2000 you can also create temporary stored procedures.
CREATE PROC #TempProc
SELECT * FROM tblPerson WHERE Name = @Name
DROP PROC #TempProc
All Temp stuff is created under tempdb..sysobjects
SELECT * FROM tempdb..sysobjects will return you #TempProc
Sometimes when retrieving data from the Database we don't want to return NULL but instead of NULL we want to return some friendly message saying 'This record is not found'. In these situations CASE function is very helpful. Look at a simple example below:
CASE WHEN Ph.CellNumber IS NULL THEN
'No CellNumber Found'
FROM tblPerson P, tblPhone Ph
WHERE P.PersonID = Ph.PersonID
You can easily populate a DropDownList with the data from the xml file. Check out the code below: XML File hank corry david james C# CODE XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("Me... XmlNodeList nodeList = doc.SelectNodes("names/name"); foreach(XmlNode node in nodeList) DropDownList1.Items.Add(new ListItem(node.SelectSingleN... ......
Most of the coders spent too much time infront of the screen writing code and reading articles. I wonder how annoyed their wife will be since they are not getting any attention. How do you resolve this issue? By the way I just got married but my wife is in a different state completing her studies hence the question is not directed to me.
I wrote an article about Exporting DataGrid to Excel which can be viewed at www.GridViewGuy.com. One question that is asked again and again was how to export the Datagrid which has the link buttons in it. If you try to export a Datagrid with link buttons inside it than it will throw an exception saying "LinkButton server control must be inside the Form tags with runat = server". If you view the html source then you will see that the LinkButton is inside the form tags with runat = server. This error ......
I don't know that if you have noticed but sometimes the events on the page are deleted automatically. Like code that was working fine will not work because non of the event handlers are attached. Does anyone knows what causes this and how to prevent this?
If you want to debug a single page say "AddArticle.aspx" and that page only appears if you log in as certain user and browse couple of pages than you are wasting too much time since your target page is only "AddArticle.aspx". What you can do is open the "AddArticle.aspx" page in a new browser and than start the debugging now you are on the page that you need to debug without having to browse multiple pages. This comes really handy if you application is large and you don't want to follow the Yellow ......
Just wanted you all to know that I will be unavailable for few days since I am getting married on August 12th 2005.
Everyone take care,
First let me start by saying this, "The code that you will see below is the worst code I have written". Okay my requirment was to compare the date in the ACCESS database and spit out the results depending on the date. The field in the database was varchar and date was stored as '03-04-2005' (mm-dd-yyyy). Now I needed to fetch all the records of a particular month and year. The barries was the inclusion of the day in the database. The month and year was selected using the dropdownlists. Here is my ......
When exporting Datagrid to excel you might need the file to open instantly without saving it. You can easily achieve this by using the code below. Just comment out the Response.Cache line and it will work fine. Response.Clear(); Response.AddHeader("content... "attachment;filename=FileNa... Response.Charset = ""; // Comment out the line below // Response.Cache.SetCacheabil... Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite ......
Talk about errors while doing a simple insert in Access Database. And the surprising thing is that you will never know what the error means since the error message is pointless. Yesterday I was executing an insert statement and keep on getting “ERROR IN THE INSERT STATEMENT”. Now I am not a psychic who can find the reason of this error by simply reading the line above but my friend google is. I found out that I was using a reserved keyword of Access, DATE. I changed my column name and it worked fine. ......
Currently I am working on a project which uses Access Database. Anyway, so I designed, populated and uploaded the database to the server and it was giving me the error that "File is already being used". I was confused since the database file was not being used by any other process. Finally, I realized that error comes when you forget to close the connection. I find it really strange because it never gave me error when running on local server. It's a very bad practice to keep the connection open for ......