Saturday, November 15, 2008
Great stylin' article for fellow coders
I ran across this excellent article on styling your web pages by Stefano Mazzocchi. It got me off ground zero on a few fronts. Great job Stefano!
Friday, October 24, 2008
ADO.Net - Return data from a stored procedure - Untyped
Suppose we have a stored procedure CustOrderHist in the Northwind database. The stored proc returns the ProductName and the total quantity ordered for that Product Name for a given customer and looks like
To call this stored proc (for customerid ALFKI) and return the data to a datatable use the following:
Have fun.
[dbo].[CustOrderHist] @CustomerID nchar(5)
AS
SELECT ProductName, Total=SUM(Quantity)
FROM Products P, [Order Details] OD, Orders O, Customers C
WHERE C.CustomerID = @CustomerID
AND C.CustomerID = O.CustomerID AND O.OrderID = OD.OrderID AND OD.ProductID = P.ProductID
GROUP BY ProductName
To call this stored proc (for customerid ALFKI) and return the data to a datatable use the following:
string strConn;
strConn = "Data Source=myMachine;Initial Catalog=Northwind;Persist Security Info=True;User ID=web_user;Password=hehe";
SqlConnection cn = new SqlConnection(strConn);
if (cn.State != ConnectionState.Open)
{
cn.Open();
}
SqlCommand cmd = new SqlCommand("CustOrderHist", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@CustomerID", "ALFKI");
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable("CustOrderHist");
da.Fill(dt);
cn.Close();
Have fun.
Thursday, July 24, 2008
Sample ADO.Net Project
Here is the sample ADO.Net project from class. Download Here I'll post the slides and more examples soon.
Friday, July 18, 2008
SQL Server 2005 - Resetting autoincrementing table id
To reset the auto-incrementing id on a table use the following syntax
declare @newseed int
select @newseed = max(columnName) from tableName
dbcc checkident(tableName, RESEED, @newseed)
Of course substituting your table name for tableName and the id column's name for columnName
declare @newseed int
select @newseed = max(columnName) from tableName
dbcc checkident(tableName, RESEED, @newseed)
Of course substituting your table name for tableName and the id column's name for columnName
Wednesday, July 16, 2008
Changing Case Sensitivity in SQL Server 2005
Here's a great "how-to" on changing your existing db to case insensitive
The bottom line is, create your db's as case insensitive using the default sql server collation settings (for US) of SQL_Latin1_General_CP1_CI_AS.
To find your current case sensitivity using the following
SELECT DATABASEPROPERTYEX(db_name, 'Collation')
For example
SELECT DATABASEPROPERTYEX('AdventureWorks','Collation')
The bottom line is, create your db's as case insensitive using the default sql server collation settings (for US) of SQL_Latin1_General_CP1_CI_AS.
To find your current case sensitivity using the following
SELECT DATABASEPROPERTYEX(db_name, 'Collation')
For example
SELECT DATABASEPROPERTYEX('AdventureWorks','Collation')
SQL Server 2005 = NULL
I am teaching a SQL Server 2005 class this week and the question of IS NULL vs. = NULL came up. While we know to use IS NULL I couldn't recall when to use = NULL. Here's a great article detailing the use for = NULL.
Understanding the difference between is null and = null
Understanding the difference between is null and = null
Tuesday, January 8, 2008
New Amarillo .Net user's group
Hey fellow developers. Head over to Amarillo Dot Net for the meeting announcement for Amarillo's new Dot Net users' group. Come out and meet some fellow Dotnetters, chow some pizza and get a look at WPF. See you there!
Monday, January 7, 2008
Who I Am
I am Todd Newell and I am an independent software developer and Information Technology consultant. I own Newell IT Services.
Newell IT Services is a full-service information technology consulting, contracting and support firm. Our primary focus is on delivering Web-based applications to our clients. These Web-based applications range from "Web-enabling" an existing business application to building brand-new applications that take advantage of existing business applications. We build most of our software using Microsoft's .Net framework, which gives us the flexibility to work with a wide array of databases and existing applications.
In addition to software development, we provide information technology consulting based on 20+ years in information technology, including more than five years as an IT director for a medium-sized business. We can help you evaluate your current technology use and systems as well as plan your future technology use and systems.
Newell IT Services is a full-service information technology consulting, contracting and support firm. Our primary focus is on delivering Web-based applications to our clients. These Web-based applications range from "Web-enabling" an existing business application to building brand-new applications that take advantage of existing business applications. We build most of our software using Microsoft's .Net framework, which gives us the flexibility to work with a wide array of databases and existing applications.
In addition to software development, we provide information technology consulting based on 20+ years in information technology, including more than five years as an IT director for a medium-sized business. We can help you evaluate your current technology use and systems as well as plan your future technology use and systems.
Hello World!
Well, here it is. My first post on the new Newell IT blog. My goals for this blog are to share some of the technologies that I am passionate about, why I am passionate about them, and provide a means of communications with other developers and small and medium-sized business owners. Some of the technologies that I am passionate about include blogs, Web-based applications and Microsoft's .NET framework.
So here goes. I hope you enjoy the ride.
So here goes. I hope you enjoy the ride.
Subscribe to:
Posts (Atom)