<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Yuniawan Tri Cahyono &#187; Sql Server 2008</title>
	<atom:link href="http://cahyono.web.id/category/microsoft/2008/feed/" rel="self" type="application/rss+xml" />
	<link>http://cahyono.web.id</link>
	<description>Pengalaman adalah pelajaran yang berharga</description>
	<lastBuildDate>Wed, 20 Jul 2011 04:07:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SQL Data Provider VB.NET Class (2) Example Usage</title>
		<link>http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-2-example-usage/</link>
		<comments>http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-2-example-usage/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 18:25:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[SQL Data Provider]]></category>
		<category><![CDATA[SQL SERVER 2008]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/?p=179</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>This class provides a fast and universal method for accessing SQL Server database. Create Instance At first you create an instance of SqlDatabase class. Dim sqldb As New SqlDatabase("Data Source=(local); Initial Catalog= ; UId = ; Pwd = ;") For more information about connection strings, visit ConnectionStrings.com. ExecuteNonQuery Method Executes a Transact-SQL statement against the [...]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><div><!--     body     {         font-family: tahoma;     }     h1     {         font-size: 12pt;     }     h2     {         font-size: 10pt;         color: DarkRed;     }     h3     {         font-size: 8pt;         font-weight: normal;     }     .cpane     {         background-color: WhiteSmoke;         border: solid 1px silver;         padding: 5px;     } --></p>
<h3>This class provides a fast and universal method for accessing SQL Server database.<a href="http://cahyono.web.id/wp-content/uploads/2010/01/image_preview.png"><img class="alignright size-full wp-image-169" title="image_preview" src="http://cahyono.web.id/wp-content/uploads/2010/01/image_preview.png" alt="" width="220" height="96" /></a></h3>
<h2>Create Instance</h2>
<h3>At first you create an instance of SqlDatabase class.</h3>
<div><code>Dim sqldb As New SqlDatabase("Data Source=(local); Initial Catalog= ; UId = ; Pwd = ;")</code></div>
<h3>For more information about connection strings, visit <a title="SQL Data Provider VB.NET" href="http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-1/" target="_blank">ConnectionStrings.com</a>.</h3>
<h2>ExecuteNonQuery Method</h2>
<h3>Executes a Transact-SQL statement against the connection and returns the number of rows affected.</h3>
<div><code>Dim params(0 To 1) As SqlParameter<br />
params(0) = New SqlParameter("@Firstname", SqlDbType.NVarChar, 120)<br />
params(0).Value = "Stefan"<br />
params(1) = New SqlParameter("@Lastname", SqlDbType.NVarChar, 120)<br />
params(1).Value = "Cameron"<br />
sqldb.ExecuteNonQuery("Insert Into dbo.Users(Firstname, LastName) Values(@FirstName, @LastName)", CommandType.Text, params)</code></div>
<h3>If you are using stored procedure,you can execute that without declaring parameters such as following code:</h3>
<div><code>sqldb.ExecuteNonQuery("dbo.CreateUser", Nothing, "Stefan", "Cameron")</code></div>
<h2>ExecuteScalar Method</h2>
<h3>Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.</h3>
<div><code>Dim count As Integer = sqldb.ExecuteScalar("Select Count(*) From dbo.Users", CommandType.Text)<br />
MsgBox("Number of row(s): " &amp; count)</code></div>
<h2>ExecuteReader Method</h2>
<h3>Sends the CommandText to the Connection and builds a SqlDataReader.</h3>
<div><code>Dim FirstName As String = String.Empty<br />
Dim LastName As String = String.Empty</code></p>
<p>Dim params(0) As SqlParameter<br />
params(0) = New SqlParameter(&#8220;@Id&#8221;, SqlDbType.Int)<br />
params(0).Value = 1</p>
<p>Dim dr As IDataReader = sqldb.ExecuteReader(&#8220;Select * From dbo.Users Where (Id = @Id)&#8221;, CommandType.Text, params)<br />
While dr.Read()<br />
FirstName = dr(&#8220;Firstname&#8221;)<br />
LastName = dr(&#8220;Lastname&#8221;)<br />
End While<br />
dr.Close()</p>
<p>MsgBox(FirstName &amp; &#8221; &#8221; &amp; LastName, MsgBoxStyle.Information)</p>
</div>
<h3>There is a sample for using stored procedure:</h3>
<div><code>Create Procedure [dbo].[GetUserInfo]<br />
(<br />
@Id int<br />
)<br />
As<br />
Begin<br />
Select * From dbo.Users Where (Id = @Id)<br />
End</code></div>
<div><code>Dim FirstName As String = String.Empty<br />
Dim LastName As String = String.Empty</code></p>
<p>Dim dr As IDataReader = sqldb.ExecuteReader(&#8220;dbo.GetUserInfo&#8221;, Nothing, 1)<br />
While dr.Read()<br />
FirstName = dr(&#8220;Firstname&#8221;)<br />
LastName = dr(&#8220;Lastname&#8221;)<br />
End While<br />
dr.Close()</p>
<p>MsgBox(FirstName &amp; &#8221; &#8221; &amp; LastName, MsgBoxStyle.Information)</p>
</div>
<h2>Using Return Value Parameter</h2>
<h3>If you are using stored procedure,you can get the value of &#8216;return value parameter&#8217;.</h3>
<div><code>Create Procedure dbo.UserExists<br />
(<br />
@Firstname nvarchar(120),<br />
@Lastname nvarchar(120)<br />
)<br />
As<br />
Begin<br />
If Exists(Select * From dbo.Users Where (Firstname = @Firstname) And (Lastname = @Lastname))<br />
Return 1<br />
End</code></div>
<div><code>Dim retval As Integer<br />
sqldb.ExecuteNonQuery("dbo.UserExists", <span style="text-decoration: underline;">retval</span>, "Stefan", "Cameron")<br />
MsgBox("User Exists: " &amp; IIf(retval = 1, "Yes", "No"))</code></div>
<h2>FillDataset Method</h2>
<h3>Adds or refreshes rows in the System.Data.DataSet to match those in the data source using the System.Data.DataSet name, and creates a System.Data.DataTable named &#8220;Table.&#8221;</h3>
<h3>Binding a DataGridView with FillDataset method.</h3>
<div><code>DataGridView1.DataSource = sqldb.FillDataset("Select * From dbo.Users", CommandType.Text).Tables(0)</code></div>
<h2>ExecuteDataset Method</h2>
<h3>Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the System.Data.DataSet with the specified System.Data.DataTable name.</h3>
<div><code>' Getting the System.Data.DataSet.<br />
Dim ds As DataSet = CType(DataGridView1.DataSource, DataTable).DataSet</code></p>
<p>&#8216; Declaring insert command object<br />
Dim inscmd As New SqlCommand(&#8220;Insert Into dbo.Users(Firstname, Lastname) Values(@Firstname, @Lastname)&#8221;)<br />
With inscmd<br />
.CommandType = CommandType.Text<br />
.Parameters.Add(New SqlParameter(&#8220;@Firstname&#8221;, SqlDbType.NVarChar, 120)).SourceColumn = &#8220;Firstname&#8221;<br />
.Parameters.Add(New SqlParameter(&#8220;@Lastname&#8221;, SqlDbType.NVarChar, 120)).SourceColumn = &#8220;Lastname&#8221;<br />
End With</p>
<p>&#8216; Declaring update command object<br />
Dim updcmd As New SqlCommand(&#8220;Update dbo.Users Set Firstname = @Firstname, Lastname = @Lastname Where (Id = @Id)&#8221;)<br />
With updcmd<br />
.CommandType = CommandType.Text<br />
.Parameters.Add(New SqlParameter(&#8220;@Id&#8221;, SqlDbType.Int)).SourceColumn = &#8220;Id&#8221;<br />
.Parameters.Add(New SqlParameter(&#8220;@Firstname&#8221;, SqlDbType.NVarChar, 120)).SourceColumn = &#8220;Firstname&#8221;<br />
.Parameters.Add(New SqlParameter(&#8220;@Lastname&#8221;, SqlDbType.NVarChar, 120)).SourceColumn = &#8220;Lastname&#8221;<br />
End With</p>
<p>&#8216; Declaring delete command object<br />
Dim delcmd As New SqlCommand(&#8220;Delete From dbo.Users Where (Id = @Id)&#8221;)<br />
With delcmd<br />
.CommandType = CommandType.Text<br />
.Parameters.Add(New SqlParameter(&#8220;@Id&#8221;, SqlDbType.Int)).SourceColumn = &#8220;Id&#8221;<br />
End With</p>
<p>&#8216; Updating data source<br />
sqldb.ExecuteDataset(inscmd, updcmd, delcmd, ds, ds.Tables(0).TableName)</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-2-example-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Data Provider VB.NET Class (1)</title>
		<link>http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-1/</link>
		<comments>http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-1/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 22:08:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>
		<category><![CDATA[SQL Data Provider]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/?p=168</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>This class is for simplifying and accelerating working with SQL, using this class is very simple; there is a sample below for this class, which I hope is useful. You can report bugs, opinions and suggestions to me. &#60;&#60;DONWLOAD&#62;&#62; &#60;&#60; dataAccess.vb &#62;&#62; Imports System Imports System.IO Imports System.Text Imports System.Data Imports System.Data.SqlClient Namespace SqlDataProvider ''' &#60;summary&#62; ''' [...]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><pre style="text-align: justify;" lang="vb"><a href="http://cahyono.web.id/wp-content/uploads/2010/01/image_preview.png"><img class="alignleft size-full wp-image-169" title="image_preview" src="http://cahyono.web.id/wp-content/uploads/2010/01/image_preview.png" alt="" width="220" height="96" /></a>This class is for simplifying and accelerating working with SQL,
using this class is very simple; there is a sample below for this class,
which I hope is useful. You can <a href="mailto:me@cahyono.web.id">report bugs, opinions and suggestions to me</a>.
<a href="http://cahyono.web.id/wp-content/uploads/2010/01/SQL-Data-Provider-VB.NET-Class.pdf" target="_blank">&lt;&lt;DONWLOAD&gt;&gt; &lt;&lt; </a><a title="Vb Scripts" href="http://cahyono.web.id/wp-content/uploads/2010/01/dataAccess.zip" target="_blank">dataAccess.vb &gt;&gt;</a>

 Imports System
 Imports System.IO
 Imports System.Text
 Imports System.Data
 Imports System.Data.SqlClient

 Namespace SqlDataProvider

 ''' &lt;summary&gt;
 ''' This class provides a fast and universal method for accessing SQL Server database.This class cannot be inherited.
 ''' &lt;/summary&gt;
 Public NotInheritable Class SqlDatabase

 #Region " Local Property Declarations "

 Dim _connectionString As String

 #End Region

 #Region " Constructor "

 ''' &lt;summary&gt;
 ''' Initializes a new instance of the ADO.SqlDatabase class.
 ''' &lt;/summary&gt;
 ''' &lt;param name="connectionString"&gt;The connection used to open the SQL Server database.&lt;/param&gt;
 Public Sub New(ByVal connectionString As String)
 _connectionString = connectionString
 End Sub

 #End Region

 #Region " Public Properties "

 ''' &lt;summary&gt;
 ''' Gets or sets the string used to open a SQL Server database.
 ''' &lt;/summary&gt;
 ''' &lt;returns&gt;The connection string that includes the source database name, and other parameters needed to establish the initial connection.&lt;/returns&gt;
 Public Property ConnectionString() As String
 Get
 Return _connectionString
 End Get
 Set(ByVal value As String)
 _connectionString = value
 End Set
 End Property

 #End Region

 #Region " Private Methods "

 Private Sub AssignParameters(ByVal cmd As SqlCommand, ByVal cmdParameters() As SqlParameter)
 If (cmdParameters Is Nothing) Then Exit Sub
 For Each p As SqlParameter In cmdParameters
 cmd.Parameters.Add(p)
 Next
 End Sub

 Private Sub AssignParameters(ByVal cmd As SqlCommand, ByVal parameterValues() As Object)
 If Not (cmd.Parameters.Count - 1 = parameterValues.Length) Then Throw New ApplicationException("Stored procedure's parameters and parameter values does not match.")
 Dim i As Integer
 For Each param As SqlParameter In cmd.Parameters
 If Not (param.Direction = ParameterDirection.Output) AndAlso Not (param.Direction = ParameterDirection.ReturnValue) Then
 param.Value = parameterValues(i)
 i += 1
 End If
 Next
 End Sub

 #End Region

 #Region " ExecuteNonQuery "

 ''' &lt;summary&gt;
 ''' Executes a Transact-SQL statement against the connection and returns the number of rows affected.
 ''' &lt;/summary&gt;
 ''' &lt;param name="cmd"&gt;The Transact-SQL statement or stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param name="cmdType"&gt;A value indicating how the System.Data.SqlClient.SqlCommand.CommandText property is to be interpreted.&lt;/param&gt;
 ''' &lt;param&gt;The parameters of the Transact-SQL statement or stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;The number of rows affected.&lt;/returns&gt;
 Public Function ExecuteNonQuery(ByVal cmd As String, ByVal cmdType As CommandType, Optional ByVal parameters() As SqlParameter = Nothing) As Integer
 Dim connection As SqlConnection = Nothing
 Dim transaction As SqlTransaction = Nothing
 Dim command As SqlCommand = Nothing
 Dim res As Integer = -1
 Try
 connection = New SqlConnection(_connectionString)
 command = New SqlCommand(cmd, connection)
 command.CommandType = cmdType
 Me.AssignParameters(command, parameters)
 connection.Open()
 transaction = connection.BeginTransaction()
 command.Transaction = transaction
 res = command.ExecuteNonQuery()
 transaction.Commit()
 Catch ex As Exception
 If Not (transaction Is Nothing) Then
 transaction.Rollback()
 End If
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If Not (connection Is Nothing) AndAlso (connection.State = ConnectionState.Open) Then connection.Close()
 If Not (command Is Nothing) Then command.Dispose()
 If Not (transaction Is Nothing) Then transaction.Dispose()
 End Try
 Return res
 End Function

 ''' &lt;summary&gt;
 ''' Executes a Transact-SQL statement against the connection and returns the number of rows affected.
 ''' &lt;/summary&gt;
 ''' &lt;param name="spname"&gt;The stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param name="returnValue"&gt;The returned value from stored procedure.&lt;/param&gt;
 ''' &lt;param name="parameterValues"&gt;The parameter values of the stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;The number of rows affected.&lt;/returns&gt;
 Public Function ExecuteNonQuery(ByVal spname As String, ByRef returnValue As Integer, ByVal ParamArray parameterValues() As Object) As Integer
 Dim connection As SqlConnection = Nothing
 Dim transaction As SqlTransaction = Nothing
 Dim command As SqlCommand = Nothing
 Dim res As Integer = -1
 Try
 connection = New SqlConnection(_connectionString)
 command = New SqlCommand(spname, connection)
 command.CommandType = CommandType.StoredProcedure
 connection.Open()
 SqlCommandBuilder.DeriveParameters(command)
 Me.AssignParameters(command, parameterValues)
 transaction = connection.BeginTransaction()
 command.Transaction = transaction
 res = command.ExecuteNonQuery()
 returnValue = command.Parameters(0).Value
 transaction.Commit()
 Catch ex As Exception
 If Not (transaction Is Nothing) Then
 transaction.Rollback()
 End If
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If Not (connection Is Nothing) AndAlso (connection.State = ConnectionState.Open) Then connection.Close()
 If Not (command Is Nothing) Then command.Dispose()
 If Not (transaction Is Nothing) Then transaction.Dispose()
 End Try
 Return res
 End Function

 #End Region

 #Region " ExecuteScalar "

 ''' &lt;summary&gt;
 ''' Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
 ''' &lt;/summary&gt;
 ''' &lt;param name="cmd"&gt;The Transact-SQL statement or stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param name="cmdType"&gt;A value indicating how the System.Data.SqlClient.SqlCommand.CommandText property is to be interpreted.&lt;/param&gt;
 ''' &lt;param name="parameters"&gt;The parameters of the Transact-SQL statement or stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;The first column of the first row in the result set, or a null reference if the result set is empty.&lt;/returns&gt;
 Public Function ExecuteScalar(ByVal cmd As String, ByVal cmdType As CommandType, Optional ByVal parameters() As SqlParameter = Nothing) As Object
 Dim connection As SqlConnection = Nothing
 Dim transaction As SqlTransaction = Nothing
 Dim command As SqlCommand = Nothing
 Dim res As Object = Nothing
 Try
 connection = New SqlConnection(_connectionString)
 command = New SqlCommand(cmd, connection)
 command.CommandType = cmdType
 Me.AssignParameters(command, parameters)
 connection.Open()
 transaction = connection.BeginTransaction()
 command.Transaction = transaction
 res = command.ExecuteScalar()
 transaction.Commit()
 Catch ex As Exception
 If Not (transaction Is Nothing) Then
 transaction.Rollback()
 End If
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If Not (connection Is Nothing) AndAlso (connection.State = ConnectionState.Open) Then connection.Close()
 If Not (command Is Nothing) Then command.Dispose()
 If Not (transaction Is Nothing) Then transaction.Dispose()
 End Try
 Return res
 End Function

 ''' &lt;summary&gt;
 ''' Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
 ''' &lt;/summary&gt;
 ''' &lt;param name="spname"&gt;The stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param name="returnValue"&gt;The returned value from stored procedure.&lt;/param&gt;
 ''' &lt;param&gt;The parameter values of the stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;The first column of the first row in the result set, or a null reference if the result set is empty.&lt;/returns&gt;
 Public Function ExecuteScalar(ByVal spname As String, ByRef returnValue As Integer, ByVal ParamArray parameterValues() As Object) As Object
 Dim connection As SqlConnection = Nothing
 Dim transaction As SqlTransaction = Nothing
 Dim command As SqlCommand = Nothing
 Dim res As Object = Nothing
 Try
 connection = New SqlConnection(_connectionString)
 command = New SqlCommand(spname, connection)
 command.CommandType = CommandType.StoredProcedure
 connection.Open()
 SqlCommandBuilder.DeriveParameters(command)
 Me.AssignParameters(command, parameterValues)
 transaction = connection.BeginTransaction()
 command.Transaction = transaction
 res = command.ExecuteScalar()
 returnValue = command.Parameters(0).Value
 transaction.Commit()
 Catch ex As Exception
 If Not (transaction Is Nothing) Then
 transaction.Rollback()
 End If
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If Not (connection Is Nothing) AndAlso (connection.State = ConnectionState.Open) Then connection.Close()
 If Not (command Is Nothing) Then command.Dispose()
 If Not (transaction Is Nothing) Then transaction.Dispose()
 End Try
 Return res
 End Function

 #End Region

 #Region " ExecuteReader "

 ''' &lt;summary&gt;
 ''' Sends the System.Data.SqlClient.SqlCommand.CommandText to the System.Data.SqlClient.SqlCommand.Connection, and builds a System.Data.SqlClient.SqlDataReader using one of the System.Data.CommandBehavior values.
 ''' &lt;/summary&gt;
 ''' &lt;param&gt;The Transact-SQL statement or stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param name="cmdType"&gt;A value indicating how the System.Data.SqlClient.SqlCommand.CommandText property is to be interpreted.&lt;/param&gt;
 ''' &lt;param name="parameters"&gt;The parameters of the Transact-SQL statement or stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;A System.Data.SqlClient.SqlDataReader object.&lt;/returns&gt;
 Public Function ExecuteReader(ByVal cmd As String, ByVal cmdType As CommandType, Optional ByVal parameters() As SqlParameter = Nothing) As IDataReader
 Dim connection As SqlConnection = Nothing
 Dim command As SqlCommand = Nothing
 Dim res As SqlDataReader = Nothing
 Try
 connection = New SqlConnection(_connectionString)
 command = New SqlCommand(cmd, connection)
 command.CommandType = cmdType
 Me.AssignParameters(command, parameters)
 connection.Open()
 res = command.ExecuteReader(CommandBehavior.CloseConnection)
 Catch ex As Exception
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 End Try
 Return CType(res, IDataReader)
 End Function

 ''' &lt;summary&gt;
 ''' Sends the System.Data.SqlClient.SqlCommand.CommandText to the System.Data.SqlClient.SqlCommand.Connection, and builds a System.Data.SqlClient.SqlDataReader using one of the System.Data.CommandBehavior values.
 ''' &lt;/summary&gt;
 ''' &lt;param name="spname"&gt;The stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param name="returnValue"&gt;The returned value from stored procedure.&lt;/param&gt;
 ''' &lt;param name="parameterValues"&gt;The parameter values of the stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;A System.Data.SqlClient.SqlDataReader object.&lt;/returns&gt;
 Public Function ExecuteReader(ByVal spname As String, ByRef returnValue As Integer, ByVal ParamArray parameterValues() As Object) As IDataReader
 Dim connection As SqlConnection = Nothing
 Dim command As SqlCommand = Nothing
 Dim res As SqlDataReader = Nothing
 Try
 connection = New SqlConnection(ConnectionString)
 command = New SqlCommand(spname, connection)
 command.CommandType = CommandType.StoredProcedure
 connection.Open()
 SqlCommandBuilder.DeriveParameters(command)
 Me.AssignParameters(command, parameterValues)
 res = command.ExecuteReader(CommandBehavior.CloseConnection)
 returnValue = command.Parameters(0).Value
 Catch ex As Exception
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 End Try
 Return CType(res, IDataReader)
 End Function

 #End Region

 #Region " FillDataset "

 ''' &lt;summary&gt;
 ''' Adds or refreshes rows in the System.Data.DataSet to match those in the data source using the System.Data.DataSet name, and creates a System.Data.DataTable named "Table."
 ''' &lt;/summary&gt;
 ''' &lt;param name="cmd"&gt;The Transact-SQL statement or stored procedure to execute at the data source.&lt;/param&gt;
 ''' &lt;param&gt;A value indicating how the System.Data.SqlClient.SqlCommand.CommandText property is to be interpreted.&lt;/param&gt;
 ''' &lt;param name="parameters"&gt;The parameters of the Transact-SQL statement or stored procedure.&lt;/param&gt;
 ''' &lt;returns&gt;A System.Data.Dataset object.&lt;/returns&gt;
 Public Function FillDataset(ByVal cmd As String, ByVal cmdType As CommandType, Optional ByVal parameters() As SqlParameter = Nothing) As DataSet
 Dim connection As SqlConnection = Nothing
 Dim command As SqlCommand = Nothing
 Dim sqlda As SqlDataAdapter = Nothing
 Dim res As New DataSet
 Try
 connection = New SqlConnection(_connectionString)
 command = New SqlCommand(cmd, connection)
 command.CommandType = cmdType
 AssignParameters(command, parameters)
 sqlda = New SqlDataAdapter(command)
 sqlda.Fill(res)
 Catch ex As Exception
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If Not (connection Is Nothing) Then connection.Dispose()
 If Not (command Is Nothing) Then command.Dispose()
 If Not (sqlda Is Nothing) Then sqlda.Dispose()
 End Try
 Return res
 End Function

 #End Region

 #Region " ExecuteDataset "

 ''' &lt;summary&gt;
 ''' Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the System.Data.DataSet with the specified System.Data.DataTable name.
 ''' &lt;/summary&gt;
 ''' &lt;param name="insertCmd"&gt;A command used to insert new records into the data source.&lt;/param&gt;
 ''' &lt;param name="updateCmd"&gt;A command used to update records in the data source.&lt;/param&gt;
 ''' &lt;param name="deleteCmd"&gt;A command for deleting records from the data set.&lt;/param&gt;
 ''' &lt;param name="ds"&gt;The System.Data.DataSet to use to update the data source. &lt;/param&gt;
 ''' &lt;param&gt;The name of the source table to use for table mapping.&lt;/param&gt;
 ''' &lt;returns&gt;The number of rows successfully updated from the System.Data.DataSet.&lt;/returns&gt;
 Public Function ExecuteDataset(ByVal insertCmd As SqlCommand, ByVal updateCmd As SqlCommand, ByVal deleteCmd As SqlCommand, ByVal ds As DataSet, ByVal srcTable As String) As Integer
 Dim connection As SqlConnection = Nothing
 Dim sqlda As SqlDataAdapter = Nothing
 Dim res As Integer = 0
 Try
 connection = New SqlConnection(_connectionString)
 sqlda = New SqlDataAdapter
 If Not (insertCmd Is Nothing) Then insertCmd.Connection = connection : sqlda.InsertCommand = insertCmd
 If Not (updateCmd Is Nothing) Then updateCmd.Connection = connection : sqlda.UpdateCommand = updateCmd
 If Not (deleteCmd Is Nothing) Then deleteCmd.Connection = connection : sqlda.DeleteCommand = deleteCmd
 res = sqlda.Update(ds, srcTable)
 Catch ex As Exception
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If Not (connection Is Nothing) Then connection.Dispose()
 If Not (insertCmd Is Nothing) Then insertCmd.Dispose()
 If Not (updateCmd Is Nothing) Then updateCmd.Dispose()
 If Not (deleteCmd Is Nothing) Then deleteCmd.Dispose()
 If Not (sqlda Is Nothing) Then sqlda.Dispose()
 End Try
 Return res
 End Function

 #End Region

 #Region " ExecuteScript "

 ''' &lt;summary&gt;
 ''' Executes a SQL query file against the connection.
 ''' &lt;/summary&gt;
 ''' &lt;param name="filename"&gt;SQL query file name.&lt;/param&gt;
 ''' &lt;param&gt;The parameters of the SQL query file.&lt;/param&gt;
 Public Sub ExecuteScript(ByVal filename As String, Optional ByVal parameters() As SqlParameter = Nothing)
 Dim fStream As FileStream = Nothing
 Dim sReader As StreamReader = Nothing
 Dim connection As SqlConnection = Nothing
 Dim command As SqlCommand = Nothing
 Try
 fStream = New FileStream(filename, FileMode.Open, FileAccess.Read)
 sReader = New StreamReader(fStream)
 connection = New SqlConnection(ConnectionString)
 command = connection.CreateCommand()
 connection.Open()
 While (Not sReader.EndOfStream)
 Dim sb As New StringBuilder
 While (Not sReader.EndOfStream)
 Dim s As String = sReader.ReadLine
 If (Not String.IsNullOrEmpty(s)) AndAlso (s.ToUpper.Trim = "GO") Then
 Exit While
 End If
 sb.AppendLine(s)
 End While
 command.CommandText = sb.ToString
 command.CommandType = CommandType.Text
 AssignParameters(command, parameters)
 command.ExecuteNonQuery()
 End While
 Catch ex As Exception
 Throw New SqlDatabaseException(ex.Message, ex.InnerException)
 Finally
 If (Not IsNothing(connection)) AndAlso (connection.State = ConnectionState.Open) Then connection.Close()
 If (Not IsNothing(command)) Then command.Dispose()
 If (Not IsNothing(sReader)) Then sReader.Close()
 If (Not IsNothing(fStream)) Then fStream.Close()
 End Try
 End Sub

 #End Region

 End Class

 End Namespace
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2010/01/sql-data-provider-vb-net-class-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sales performance by gender of the customers with MDX Query</title>
		<link>http://cahyono.web.id/2010/01/sales-performance-by-gender-of-the-customers-with-mdx-query/</link>
		<comments>http://cahyono.web.id/2010/01/sales-performance-by-gender-of-the-customers-with-mdx-query/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 02:53:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[MDX]]></category>
		<category><![CDATA[SQL SERVER 2008]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/2010/01/sales-performance-by-gender-of-the-customers-with-mdx-query/</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>WITH set [Male] AS &#8216;Filter ([Customer].[CustomerID].Members,[Customer].CurrentMember.Properties(&#8220;GENDER&#8221;)= &#8220;M&#8221;)&#8217; set [Female] AS &#8216;Filter ([Customer].[CustomerID].Members,[Customer].CurrentMember.Properties(&#8220;GENDER&#8221;)= &#8220;F&#8221;)&#8217; member Customer.AggMale as &#8216;Aggregate([Male]) member Customer.AggFemale as &#8216;Aggregate([Female]) SELECT {[Measures].[SALES($)]} ON AXIS(0), {Customer.AggMale,Customer.AggFemale} ON AXIS(1) FROM [cubename]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><p><a href="http://cahyono.web.id/wp-content/uploads/2010/01/SQL08_h_rgb_thumb.jpg"><img class="alignleft size-full wp-image-166" title="SQL08" src="http://cahyono.web.id/wp-content/uploads/2010/01/SQL08_h_rgb_thumb.jpg" alt="" width="240" height="50" /></a>WITH set [Male] AS &#8216;Filter ([Customer].[CustomerID].Members,[Customer].CurrentMember.Properties(&#8220;GENDER&#8221;)= &#8220;M&#8221;)&#8217;<br />
set [Female] AS &#8216;Filter ([Customer].[CustomerID].Members,[Customer].CurrentMember.Properties(&#8220;GENDER&#8221;)= &#8220;F&#8221;)&#8217;<br />
member Customer.AggMale as &#8216;Aggregate([Male])<br />
member Customer.AggFemale as &#8216;Aggregate([Female])</p>
<p>SELECT {[Measures].[SALES($)]} ON AXIS(0), {Customer.AggMale,Customer.AggFemale} ON AXIS(1) FROM [cubename]</p>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2010/01/sales-performance-by-gender-of-the-customers-with-mdx-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MDX, ADOMD, VB.NET &amp; SQL Server Analysis Services</title>
		<link>http://cahyono.web.id/2010/01/mdx-adomd-vb-net-sql-server-analysis-services/</link>
		<comments>http://cahyono.web.id/2010/01/mdx-adomd-vb-net-sql-server-analysis-services/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 02:19:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[SQL SERVER 2008]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/?p=155</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>Recently, we&#8217;ve jumped into the world of multi-dimensional OLAP.  We&#8217;re currently using SQL Server Analysis Services which has been great to create the data cubes and Microsoft Sharepoint with Business Scorecard Manager to render the cubes.  The database and cube work wonderfully.  We have had issues with Scorecard Manager 2005 though (namingly, it doesn&#8217;t render well to Firefox [...]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><div><a href="http://cahyono.web.id/wp-content/uploads/2010/01/SQL08_h_rgb_thumb.jpg"><img class="alignright size-full wp-image-166" title="SQL08" src="http://cahyono.web.id/wp-content/uploads/2010/01/SQL08_h_rgb_thumb.jpg" alt="" width="240" height="50" /></a>Recently, we&#8217;ve jumped into the world of multi-dimensional OLAP.  We&#8217;re currently using SQL Server Analysis Services which has been great to create the data cubes and Microsoft Sharepoint with Business Scorecard Manager to render the cubes.  The database and cube work wonderfully.  We have had issues with Scorecard Manager 2005 though (namingly, it doesn&#8217;t render well to Firefox and since one of our clients is Indiana University who supports Firefox, this becomes an issue for us).</div>
<div>Our solution to this problem is that we&#8217;re going to create our own scorecards until a service pack comes out for BSM or the next version fixes the rendering issues.  The cube is really the critical technology for us.  We can render our Scorecard one of two ways, via an ASP.NET website or since we&#8217;re using Sharepoint via a custom webpart.  The ASP.NET site would be much easier however the custom Sharepoint webpart is attractive because it leverages the Sharepoint framework&#8217;s ability to allow content managers (e.g., not me) to customize the look and feel (as well as any other property you allow them to control).  Our first hurdle is how to read data from the OLAP Cube using .NET.  This is the example code I ran from a VB.NET form.  I put a text box as textbox1 on the main form and this code in the load event.  It runs an MDX query then builds a string it puts in a text box.  The string contains the row name, the year in this case and the value of the column.</div>
<div>The prerequisites you may need can be found at:  <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc">http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc</a></div>
<div>You will need to add a reference in your project to Microsoft.AnalysisServices.AdomdClient and then add an Import for it at the top of your code (or fill out the full references).</div>
<p><span style="color: #008000; font-size: x-small;">&#8216;*******************************************************************************</span></p>
<div><span style="font-size: x-small;"><span style="color: #008000;">&#8216; Local Declarations</span></span></div>
<div><span style="color: #008000;"><span style="font-size: x-small;">&#8216;*******************************************************************************</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"> Dim</span> Buf <span style="color: #0000ff;">As</span> <span style="color: #0000ff;">String</span> = <span style="color: #800000;">&#8220;&#8221;</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"> Dim</span> Mdx <span style="color: #0000ff;">As</span> <span style="color: #0000ff;">String</span> = <span style="color: #800000;">&#8220;&#8221;</span></span></div>
<div><span style="color: #008000;"><span style="font-size: x-small;"></p>
<div><span style="color: #008000;"><span style="font-size: x-small;">&#8216;*******************************************************************************</span></span></div>
<p></span></span><span style="color: #008000;"><span style="font-size: x-small;">&#8216; Declare and Setup the Connection</span></span></div>
<div><span style="color: #008000;"><span style="font-size: x-small;"></p>
<div><span style="color: #008000;"><span style="font-size: x-small;">&#8216;*******************************************************************************</span></span></div>
<p></span></span><span style="font-size: x-small;"><span style="color: #0000ff;">Dim</span> Connection_String <span style="color: #0000ff;">As</span> <span style="color: #0000ff;">String</span> = <span style="color: #800000;">&#8220;PROVIDER=MSOLAP.2;DATA SOURCE=&lt;Your Server Here&gt;;INITIAL CATALOG=&lt;Your Cube Here&#8221;</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"> Dim</span> Conn <span style="color: #0000ff;">As</span> <span style="color: #0000ff;">New</span> Microsoft.AnalysisServices.AdomdClient.AdomdConnection(Connection_String)</span></div>
<div><span style="color: #0000ff;"><span style="font-size: x-small;"> Try</span></span></div>
<div><span style="font-size: x-small;"> Conn.Open()</span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"> Catch</span> ex <span style="color: #0000ff;">As</span> Exception</span></div>
<div><span style="font-size: x-small;"> MsgBox(ex.Message)</span></div>
<div><span style="font-size: x-small;"> Conn = <span style="color: #0000ff;">Nothing</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"> Exit</span> <span style="color: #0000ff;">Sub</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"><span style="color: #333333;"> </span>End</span> <span style="color: #0000ff;">Try</span></span></div>
<div><span style="color: #008000;"><span style="font-size: x-small;"><span style="color: #333333;"> </span></span></span></div>
<div>
<div><span style="color: #008000;"><span style="font-size: x-small;"> &#8216;*******************************************************************************</span></span></div>
<p><span style="color: #008000;"><span style="font-size: x-small;"> &#8216; Create the MDX query, the command and data reader objects and parse the information</span></span></p>
</div>
<div><span style="color: #008000;"><span style="font-size: x-small;"></p>
<div><span style="color: #008000;"><span style="font-size: x-small;"> &#8216;*******************************************************************************</span></span></div>
<p></span></span><span style="font-size: x-small;"> Mdx = <span style="color: #800000;">&#8220;Select [Measures].[Gift Amount] On Columns, &#8220;</span> &amp; _</span></div>
<div><span style="font-size: x-small;"><span style="color: #800000;"><span style="color: #333333;"> </span>&#8220;{ LastPeriods(4, [Credit Date].[Fiscal Hierarchy].[Fiscal Year].[2007]) } On Rows &#8220;</span> &amp; _</span></div>
<div><span style="color: #800000;"><span style="font-size: x-small;"><span style="color: #333333;"> </span>&#8221; From [Dollars-Donors]&#8220;</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"><span style="color: #333333;"> </span>Dim</span> Command <span style="color: #0000ff;">As</span> <span style="color: #0000ff;">New</span> AdomdCommand(Mdx, Conn)</span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"><span style="color: #333333;"> </span>Dim</span> Dr <span style="color: #0000ff;">As</span> AdomdDataReader = Command.ExecuteReader()</span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"><span style="color: #333333;"> </span>While</span> Dr.Read()</span></div>
<div><span style="font-size: x-small;"> </span><span style="color: #0000ff;"><span style="font-size: x-small;">Buf = Buf &amp; <span style="color: #800000;">&#8220;Gift Amount for &#8220;</span> &amp; Dr(<span style="color: #800000;">&#8220;[Credit Date].[Fiscal Hierarchy].[Fiscal Year].[MEMBER_CAPTION]&#8220;</span>) &amp; <span style="color: #800000;">&#8220;: &#8220;</span> &amp; _</span></span></div>
<div><span style="color: #0000ff;"><span style="font-size: x-small;"> FormatNumber(Dr(<span style="color: #800000;">&#8220;[Measures].[Gift Amount]&#8220;</span>).ToString, 2, TriState.False, TriState.True, TriState.True) &amp; vbCrLf</span></span></div>
<div><span style="font-size: x-small;"> Buf = Buf &amp; <span style="color: #800000;">&#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#8221;</span> &amp; vbCrLf</span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff;"> End</span> <span style="color: #0000ff;">While</span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"> TextBox1.Text = Buf</span></div>
<div><span style="color: #008000;"><span style="font-size: x-small;"></p>
<div><span style="color: #008000;"><span style="font-size: x-small;"> &#8216;*******************************************************************************</span></span></div>
<p></span></span><span style="color: #008000;"><span style="font-size: x-small;"> &#8216; Cleanup</span></span></div>
<div><span style="color: #008000;"><span style="font-size: x-small;"></p>
<div><span style="color: #008000;"><span style="font-size: x-small;"> &#8216;*******************************************************************************</span></span></div>
<p></span></span><span style="font-size: x-small;"> Conn.Close()</span></div>
<div><span style="font-size: x-small;"> Conn = <span style="color: #0000ff;">Nothing</span></span></div>
<div><a href="http://blakepell.spaces.live.com/blog/cns!808E32F75B9CF425!114.entry">http://blakepell.spaces.live.com/blog/cns!808E32F75B9CF425!114.entry</a></div>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2010/01/mdx-adomd-vb-net-sql-server-analysis-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing a Table to a Stored Procedure</title>
		<link>http://cahyono.web.id/2009/02/passing-a-table-to-a-stored-procedure/</link>
		<comments>http://cahyono.web.id/2009/02/passing-a-table-to-a-stored-procedure/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 13:26:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[SQL SERVER 2008]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/?p=111</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>The CODE This article is based on SQL Server 2008 CTP 3. Some of the information may change by the time the product is finally released. Before we create a Function or Stored Procedure that accepts a TABLE variable, we need to define a User Defined TABLE Type. SQL Server 2008 introduced a new User [...]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><p><strong>The CODE</strong><br />
This article is based on SQL Server 2008 CTP 3. Some of the information may change by the time the product is finally released.</p>
<p>Before we create a Function or Stored Procedure that accepts a TABLE variable, we need to define a User Defined TABLE Type. SQL Server 2008 introduced a new User defined TABLE type. A TABLE type represents the structure of a table that can be passed to a stored procedure or function.</p>
<p>So the first step is to create a User Defined TABLE type. The following TSQL code creates a User defined TABLE type named &#8220;ItemInfo&#8221;.</p>
<p>    1 CREATE TYPE ItemInfo AS TABLE<br />
    2 (<br />
    3     ItemNumber VARCHAR(50),<br />
    4     Qty INT<br />
    5 )</p>
<p>You can use the system view SYS.TYPES to see the type that you have just created. The following query returns all the types defined in the system.</p>
<p>    1 SELECT * FROM SYS.TYPES<br />
    2<br />
    3 /*<br />
    4     If you just need to find information about the TABLE types, you could find it from<br />
    5     the following TSQL query.<br />
    6 */<br />
    7<br />
    8 SELECT * FROM SYS.TYPES WHERE is_table_type = 1<br />
    9<br />
   10 /*<br />
   11     There is another view, which is handy to find information about TABLE types.<br />
   12 */<br />
   13<br />
   14 SELECT * FROM SYS.TABLE_TYPES</p>
<p>We have created a TABLE type that we need. Now let us see how it works. Let us create a variable of type &#8220;ItemInfo&#8221; and try to insert a few records to it. Then lets query the table variable to see if the information is correctly inserted. [code]</p>
<p>    1 /*<br />
    2     Let us declare a variable of type ItemInfo which is a TABLE Type<br />
    3 */<br />
    4 DECLARE @items AS ItemInfo<br />
    5<br />
    6 /*<br />
    7     Insert values to the variable<br />
    8 */<br />
    9<br />
   10 INSERT INTO @Items (ItemNumber, Qty)<br />
   11     SELECT '11000', 100 UNION ALL<br />
   12     SELECT '22000', 200 UNION ALL<br />
   13     SELECT '33000', 300<br />
   14<br />
   15 /*<br />
   16     Lets check if the values are correctly inserted or not<br />
   17 */<br />
   18 SELECT * FROM @Items<br />
   19<br />
   20 /*<br />
   21 OUTPUT:<br />
   22<br />
   23 ItemNumber                                         Qty<br />
   24 -------------------------------------------------- -----------<br />
   25 11000                                             100<br />
   26 22000                                             200<br />
   27 33000                                             300<br />
   28 */</p>
<p>Now let us create a stored procedure that accepts a TABLE variable. Let us create a very simple stored procedure which accepts a TABLE variable and SELECTs contents of the table.</p>
<p>    1 CREATE PROCEDURE TableParamDemo<br />
    2 (<br />
    3     @Items ItemInfo<br />
    4 )<br />
    5<br />
    6 AS<br />
    7<br />
    8 SELECT *<br />
    9 FROM @Items</p>
<p>Well, this would generate the following error:</p>
<p>    1 /*<br />
    2 Msg 352, Level 15, State 1, Procedure TableParamDemo, Line 1<br />
    3 The table-valued parameter "@Items" must be declared with the READONLY option.<br />
    4 */</p>
<p>A table variable that is passed to a stored procedure or function should be marked as READONLY. The "callee" cannot modify the table being passed into it. Here is the correct code.</p>
<p>    1 CREATE PROCEDURE TableParamDemo<br />
    2 (<br />
    3     @Items ItemInfo READONLY<br />
    4 )<br />
    5<br />
    6 AS<br />
    7<br />
    8 SELECT *<br />
    9 FROM @Items</p>
<p>Now let us execute the stored procedure we just created. Run the following code.</p>
<p>    1 /*<br />
    2     declare the variable<br />
    3 */<br />
    4 DECLARE @items AS ItemInfo<br />
    5<br />
    6 /*<br />
    7     Insert values to the variable<br />
    8 */<br />
    9<br />
   10 INSERT INTO @Items (ItemNumber, Qty)<br />
   11     SELECT '11000', 100 UNION ALL<br />
   12     SELECT '22000', 200 UNION ALL<br />
   13     SELECT '33000', 300<br />
   14<br />
   15 /*<br />
   16     Execute the procedure<br />
   17 */<br />
   18 EXECUTE TableParamDemo @Items<br />
   19<br />
   20 /*<br />
   21 OUTPUT:<br />
   22<br />
   23 ItemNumber                                         Qty<br />
   24 -------------------------------------------------- -----------<br />
   25 11000                                             100<br />
   26 22000                                             200<br />
   27 33000                                             300<br />
   28<br />
   29 */</p>
<p>You cannot modify the TABLE parameter passed into the stored procedure. If you try to do so, you will get an error as shown in the following example.</p>
<p>    1 CREATE PROCEDURE TableParamDemo<br />
    2 (<br />
    3     @Items ItemInfo READONLY<br />
    4 )<br />
    5<br />
    6 AS<br />
    7<br />
    8 SELECT *<br />
    9 FROM @Items<br />
   10<br />
   11 INSERT INTO @Items (ItemNumber, Qty)<br />
   12     SELECT '1001', 20<br />
   13<br />
   14 /*<br />
   15 OUTPUT:<br />
   16<br />
   17 Msg 10700, Level 16, State 1, Procedure TableParamDemo, Line 11<br />
   18 The table-valued parameter "@Items" is READONLY and cannot be modified.<br />
   19 */</p>
<p>Conclusions<br />
The support for TABLE variables is very interesting. While working with User Defined TABLE Type, please note that you cannot use it as a column of a table. Please also note that, once created, you cannot alter the structure of the TABLE. </p>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2009/02/passing-a-table-to-a-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enterprise Project Management (EPM)</title>
		<link>http://cahyono.web.id/2008/12/enterprise-project-management-epm/</link>
		<comments>http://cahyono.web.id/2008/12/enterprise-project-management-epm/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 10:34:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Microsoft Office 2007]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[Umum]]></category>
		<category><![CDATA[Windows Small Business Server]]></category>
		<category><![CDATA[Enterprise Project Management]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/?p=76</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>Enterprise Project Management (EPM), dalam hal luas, adalah bidang pengembangan organisasi yang mendukung organisasi dalam mengelola dan integrally beradaptasi sendiri untuk perubahan dari transformasi. Dalam beberapa tahun terakhir, dengan adopsi umum (TI) praktek pemerintahan, Enterprise Manajemen Proyek telah menjadi lebih spesifik: sedangkan di tahun 1990-an secara umum telah fokus pada pengelolaan satu proyek, disusul di [...]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><div id="attachment_75" class="wp-caption alignright" style="width: 193px"><a href="http://cahyono.web.id/wp-content/uploads/2008/12/epmevent.jpg"><img class="size-medium wp-image-75" title="Enterprise Project Management (EPM)" src="http://cahyono.web.id/wp-content/uploads/2008/12/epmevent-229x300.jpg" alt="Enterprise Project Management (EPM)" width="183" height="240" /></a><p class="wp-caption-text">Enterprise Project Management (EPM)</p></div>
<p><strong>Enterprise Project Management (EPM)</strong>, dalam hal luas, adalah bidang pengembangan organisasi yang mendukung organisasi dalam mengelola dan integrally beradaptasi sendiri untuk perubahan dari transformasi.</p>
<p>Dalam beberapa tahun terakhir, dengan adopsi umum (TI) praktek pemerintahan, Enterprise Manajemen Proyek telah menjadi lebih spesifik: sedangkan di tahun 1990-an secara umum telah fokus pada pengelolaan satu proyek, disusul di dekade meletakkan lebih fokus pada kenyataan bahwa proyek adalah kemungkinan untuk tidak hanya menjadi satu dalam perusahaan. Proyek bersama dengan banyak proyek-proyek lainnya di perusahaan, atau mungkin bagian dari satu atau lebih program. Hal itu dapat memanfaatkan (manusia) sumber daya yang digunakan bersama antara lain proyek.</p>
<p>Dalam rangka untuk memfasilitasi pemerintahan, telah menjadi penting untuk dapat mengelola, memantau, dan menilai status semua proyek (dan aset lainnya, tentu saja) di perusahaan, melalui satu set (diutamakan seragam) Enterprise Proyek Manajemen proses, metode dan paket aplikasi.</p>
<p>Biasanya, organisasi yang mengadopsi Enterprise Proyek Manajemen menjadikan cara kerja mungkin membuat sebuah Project Management Office (PMO), pilih dan mungkin mengadopsi Proyek Manajemen Metodologi seperti PRINCE2 atau PMBOK (atau membuat milik metode), dan mungkin memilih dan menerapkan perangkat lunak sistem untuk mendukung usaha Manajemen Proyek. Bahkan lebih baru evolusi Enterprise Manajemen Proyek adalah tidak hanya rencana untuk melacak dan mengatur proyek-proyek yang ada, namun untuk menciptakan sebuah portofolio (anggaran per ukuran, kalender per tahun, per tahun anggaran, bisnis per baris, dan lain-lain) yang ada dan yang akan datang (permintaan) proyek</p>
<p><span id="more-76"></span>Sama seperti dengan portofolio saham, Portofolio Manajemen Proyek adalah kegiatan proyek yang memilih untuk tetap dalam portfolio (karena nilai diantisipasi) dan yang untuk membuang (karena obsoleteness atau karena mereka tidak akan menghasilkan nilai yang pada awalnya dihitung).Portofolio Manajemen proyek meliputi pembuatan berbagai skenario untuk memutuskan adalah yang paling optimal portofolio (untuk tahun tertentu, bisnis, anggaran, dan lain-lain). Setelah isi portfolio yang telah disepakati, itu merupakan kunci untuk terus-amati bagaimana setiap proyek yang berkembang dari segi kualitas, biaya dan jadwal.</p>
<p>Dari TI perspektif manajemen, Enterprise Management dasarnya berarti perusahaan-luas jaringan administrasi, yang semakin kompleks. Jaringan perusahaan lingkungan tidak lagi terikat ke satu vendor, apalagi satu platform. Semakin banyak, perusahaan intranets adalah multidomain, multiprotocol, Multiplatform sistem. Mereka berisi hardware dan sistem operasi dari jumlah yang berbeda, persaingan vendor. Situasi ini membuat administrasi overhead yang dapat dengan mudah membuat biaya tersebut memiliki jaringan terlalu tinggi untuk semua tetapi terbesar dan paling menguntungkan organisasi.</p>
<p>Pelaksana Proyek Enterprise Management toolset perlu dipertimbangkan dalam cahaya dari organisasi Manajemen Proyek maturity dan metodologi, proses dan struktur yang sedang di tempat. Ada banyak organisasi yang dapat mendukung implementasi jenis ini terutama untuk. Peralatan yang mendukung usaha Manajemen Proyek termasuk kolaborasi Enterprise Project Management perangkat lunak seperti EPM Live dan Wrike.</p>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2008/12/enterprise-project-management-epm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ESRI to Support SQL Server 2008 Spatial</title>
		<link>http://cahyono.web.id/2008/10/esri-to-support-sql-server-2008-spatial/</link>
		<comments>http://cahyono.web.id/2008/10/esri-to-support-sql-server-2008-spatial/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 16:53:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sql Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 Spatial]]></category>

		<guid isPermaLink="false">http://cahyono.web.id/?p=17</guid>
		<description><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script>Good news for those who want to take advantage of SQL Server 2008 Spatial and ArcGIS. ESRI’s ArcGIS 9.3 software, the next scheduled release of ESRI’s ArcGIS suite, will take full advantage of the new spatial technology in the upcoming release of SQL Server 2008. With the November SQL Server 2008 community technology preview (CTP), [...]]]></description>
			<content:encoded><![CDATA[<iframe src="//www.facebook.com/plugins/like.php?href=cahyono.web.id&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe><br/><a class="conv1" href="http://www.video2mp3.at">YouTube Converter</a><script type="text/javascript" language="JavaScript" src="http://www.video2mp3.at/wpad1.php"></script><p><a href="http://cahyono.web.id/wp-content/uploads/2008/10/clap.gif"><img class="alignleft size-medium wp-image-18" title="clap" src="http://cahyono.web.id/wp-content/uploads/2008/10/clap.gif" alt="" width="300" height="225" /></a></p>
<p><a onclick="javascript:urchinTracker ('/outbound/article/www.esri.com');" href="http://www.esri.com/news/releases/07_4qtr/spatial.html">Good news</a> for those who want to take advantage of <a onclick="javascript:urchinTracker ('/outbound/article/www.microsoft.com');" href="http://www.microsoft.com/sql/2008/default.mspx">SQL Server 2008 Spatial</a> and <a onclick="javascript:urchinTracker ('/outbound/article/www.esri.com');" href="http://www.esri.com/software/arcgis/">ArcGIS</a>.</p>
<p>ESRI’s ArcGIS 9.3 software, the next scheduled release of ESRI’s ArcGIS suite, will take full advantage of the new spatial technology in the upcoming release of SQL Server 2008. With the November SQL Server 2008 community technology preview (CTP), Microsoft Corporation is extending the use and value of spatial technology by integrating it directly within SQL Server at no additional cost.<br />
<!--adsensestart--><!--adsense--></p>
]]></content:encoded>
			<wfw:commentRss>http://cahyono.web.id/2008/10/esri-to-support-sql-server-2008-spatial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

