Skip to content

Instantly share code, notes, and snippets.

CREATE PROCEDURE [dbo].[sp_Test3]
AS
begin try
print 'sp_Test3:updating'
update testTable2 set Num=6 where Id=2
print 'sp_Test3:updated'
end try
begin catch
print 'sp_Test3:in catch'
RAISERROR('raiseerror:sp_Test3', 16, 1)
CREATE PROCEDURE [dbo].[sp_Test2]
@table1_Id INT OUTPUT
AS
print 'sp_Test2:insert'
insert into testTable1 values('col1')
select @table1_Id = @@IDENTITY
CREATE PROCEDURE [dbo].[sp_Test1]
@table1_Id INT OUTPUT
AS
begin try
begin transaction
print 'sp_Test1:executing sp_Test2'
exec sp_Test2 @table1_Id output
print 'sp_Test1:executing sp_Test3'
exec sp_Test3
print 'commit tran'
CREATE TRIGGER [dbo].[NumTrigger]
ON [dbo].[testTable]
FOR UPDATE
AS
BEGIN
print 'begin trigger'
if UPDATE(Num)
BEGIN
DECLARE @num int
select @num=Num from inserted
public MainPage()
{
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
SearchBox.Focus(FocusState.Programmatic);
}
<Page.BottomAppBar>
<CommandBar>
<CommandBar.PrimaryCommands>
<AppBarButton Label="Emoji2" Icon="Emoji2"/>
</CommandBar.PrimaryCommands>
<CommandBar.SecondaryCommands>
<AppBarButton Label="Like" Icon="Like"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Microsoft.Live;
using Windows.UI.Popups;
using System.Collections.Generic;
namespace LiveSDKSample
{
public sealed partial class MainPage : Page
private async void DeleteButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (FolderBox.SelectedItem != null)
{
//DeleteAsync中傳入要刪除的資料夾ID
LiveOperationResult operationresult = await liveClient.DeleteAsync((FolderBox.SelectedItem as ListBoxItem).Tag.ToString());
MessageDialog msg = new MessageDialog("Folder deleted");
await msg.ShowAsync();
private async void UpdateButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (FolderBox.SelectedItem != null)
{
Dictionary<string, object> updatefolder = new Dictionary<string, object>();
updatefolder.Add("name", "updatefolder");
//PutAsync中傳入要更新的資料夾ID
LiveOperationResult operationresult = await liveClient.PutAsync((FolderBox.SelectedItem as ListBoxItem).Tag.ToString(), updatefolder);
private async void GetButton_Click(object sender, RoutedEventArgs e)
{
try
{
LiveOperationResult operationResult = await liveClient.GetAsync("me/skydrive/files");
List<object> data = (List<object>)operationResult.Result["data"];
FolderBox.Items.Clear();
foreach (dynamic item in data)
{
//將資料夾的ID記在Tag中方便做update和delete