Geeks With Blogs

News
Chris Ongsuco's Weblog Information Technology, business, life, food... February 2005 Entries
My Nerd Quiz
Just Lucky: This is what I get when I just answer without reading the questions. :-)

Try it!

Posted On Thursday, February 17, 2005 2:14 AM

SQL Running Total
Good for reporting...try it!

Use Northwind

SELECT
P.ProductID,
P.ProductName,
P.UnitsInStock,
(SELECT SUM(UnitsInStock) FROM Products WHERE ProductID <= P.ProductID) AS UnitsInStockRunningTotal
FROM Products P

Posted On Wednesday, February 16, 2005 12:25 AM

DataTableReader?! Yes Sir!
The nice thing about working fast and accurately is that you finish your work ahead of schedule. Like me if I finish my work early I'd make sure that I do something important/productive rather than waiting and do nothing. So here's something I discovered in .Net 2005 Beta 1. ConnectionStringSettingsCol... cssc = ConfigurationSettings.Conne... string connectionstring = cssc["Main"].ConnectionString; string sql = "select * from Customers"; SqlConnection conn = new SqlConnection(connectionstr... ......

Posted On Tuesday, February 8, 2005 3:47 AM

Command.ExecuteRow()
ExecuteRow is a new method in .net that will return 1 record from the query. Here is a sample from .Net Beta 1: ConnectionStringSettingsCol... cssc = ConfigurationSettings.Conne... string connectionstring = cssc["Main"].ConnectionString; string sql = "select * from Customers where CustomerId = 'ANTON' "; // Using Northwind Database SqlConnection conn = new SqlConnection(connectionstr... SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); SqlRecord record = cmd.ExecuteRow(); Response.Write(record["Cont... ......

Posted On Tuesday, February 8, 2005 3:08 AM

Playing with ExecutePageReader
I've been playing with VS.Net 2005 Beta 1 since December 2004 and here is a sample code snippet: private void BindControl(int pageIndex) { ConnectionStringSettingsCol... cssc = ConfigurationSettings.Conne... string connectionstring = cssc["Main"].ConnectionString; string sql = "select * from Customers"; // Using Northwind Database SqlConnection conn = new SqlConnection(connectionstr... SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); SqlDataReader dr = cmd.ExecutePageReader(Comma... ......

Posted On Tuesday, February 8, 2005 2:25 AM

Copyright © Chris Ongsuco | Powered by: GeeksWithBlogs.net | Join free