Google Mobile Ads

Friday, May 24, 2013

VB.NET: ListView HitTest Kullanımı

ListViewHitTestInfo Kullanımı

    Private Sub ListView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick
        If e.Button = Windows.Forms.MouseButtons.Right Then
            Dim ht As ListViewHitTestInfo = ListView1.HitTest(New Point(e.X, e.Y))
            MessageBox.Show(ht.Item.Index.ToString & " - " & ht.SubItem.Text)
        End If
    End Sub

Transact SQL : OUTPUT Clause


OUTPUT Clause
OUTPUT ile eklenen, silinen ve güncelleme yapılan tablolardaki hareketleri sadece sayısal değil değerleri ile birlikte gözlemleyebiliriz. 

MSDN açıklaması:
Returns information from, or expressions based on, each row affected by an INSERT, UPDATE, or DELETE statement. These results can be returned to the processing application for use in such things as confirmation messages, archiving, and other such application requirements. Alternatively, results can be inserted into a table or table variable.
USE tempdb
go

CREATE TABLE table1
(
    id INT,
    employee VARCHAR(32)
)
go

INSERT INTO table1 VALUES(1, 'Fred')
INSERT INTO table1 VALUES(2, 'Tom')
INSERT INTO table1 VALUES(3, 'Sally')
INSERT INTO table1 VALUES(4, 'Alice')
GO

VB.NET ile SQL Server'a Bağlanmak.

VB.NET ile SQL Server'a bağlanmak ve sorgu sonucunu datatable'a atmak.

'Imports System.Data.SqlClient
Dim con As New SqlClient.SqlConnection Dim strCon As String = "Data Source=SERVERNAME;Initial Catalog=DATABASENAME;Integrated Security=SSPI;Connection Timeout=10;" 'NT Authentication 'For SQL Authentication Dim strCon As String = "Data Source=SERVERNAME;Initial Catalog=DATABASENAME;User ID=USERNAME;Password=PASSWORD;Connection Timeout=50;" Dim strCommand As String = "SELECT * FROM TABLE" Dim command As SqlCommand Dim da As SqlDataAdapter Dim dt As New DataTable Try con.ConnectionString = strCon command = New SqlCommand(strCommand, con) command.CommandTimeout = 3000
da = New SqlDataAdapter(command) da.Fill(dt) MsgBox(dt.Rows.Count.ToString())
'FOR INSERT, UPDATE, DELETE, USE BELOW
'Dim count as Integer = command.ExecuteNonQuery()
'count is the affected row number
Catch ex As Exception MessageBox.Show(ex.Message, "Error") Finally If con.State = ConnectionState.Open Then con.Close() End If End Try

SQL SERVER'da bir kolonun adını değiştirmek.

Herhangi bir kolonun adını değiştirmek için,
sp_RENAME 'TableName.[OldColumnName]' '[NewColumnName]''COLUMN'
Herhangi bir nesnenin adını değiştirmek için (table, sp vs.) :
sp_RENAME '[OldTableName]' '[NewTableName]'

Tuesday, May 21, 2013

SQL Server 2012 Sertifikasyon Sınavları

SQL Server 2012 Sertifikasyon Sınavları

MCSA: SQL Server

Solutions Associate


70-461 -> Querying Microsoft SQL Server 2012
70-462 -> Administering Microsoft SQL Server 2012 Databases
70-463 -> Implementing a Data Warehouse with Microsoft SQL Server 2012

LinkWithin

Related Posts Plugin for WordPress, Blogger...