大佬教程收集整理的这篇文章主要介绍了Silverlight 2.0 資料庫應用程式開發(1),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
註:多數瀏覽器都有一種以離線模式執行網頁的設定,將離線模式打開,你依舊能在離線模式下運行
Silverlight
程式,在適當的設計下,其實也能做出
[
偶爾連線
]
模式。
|
DBProvider.ashx.cs
|
@H_403_1216@
@H_403_1216@
@H_403_1216@ using (sqlConnection conn = new sqlConnection(@"Data source=./sqlEXPRESS;AttachDbFilename=|DataDirectory|/MyDatabase.mdf;Integrated Security=True;User Instance=True"))
@H_403_1216@ CommandBehavior.CloseConnection))
@H_403_1216@ while (reader.Read())
@H_403_1216@ elem.Add(new XAttribute("CUSTOMER_NAME",
@H_403_1216@ reader.GetString(reader.GetOrdinal("CUSTOMER_NAME"))));
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ public bool IsReusable
@H_403_1216@ get
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@}
|
Page.xaml
|
<
UserControl
x
:
Class
="DBDemo1.Page"
@H_403_1216@ xmlns:x="http://scheR_585_11845@as.microsoft.com/winfx/2006/xaml" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
@H_403_1216@ Width="400" Height="300" Loaded="UserControl_Loaded">
</
Grid
>
</
UserControl
>
|
Page.xaml.cs
|
@H_403_1216@
@H_403_1216@ public partial class Page : UserControl
@H_403_1216@ public Page()
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ using (Stream stream = response.GetResponseStream())
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ XDocument doc = (XDocument)state;
@H_403_1216@ NAME = s1.Attribute("CUSTOMER_NAME").Value
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ public class Customer
@H_403_1216@ }
@H_403_1216@}
|
DBservice.svc.cs
|
@H_403_1216@
@H_403_1216@ [OperationContract]
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ public CUSTOMERS[] GetData()
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@}
|
web.config
|
............
<
identity
>
</
identity
>
</
endpoint
>
<
endpoint
address
=
@H_403_1216@"@H_202_1355@mex"binding="@H_202_1355@mexhttpBinding"contract="IMetadataExchange" />
............
|
Page2.xaml
|
<
UserControl
x
:
Class
="DBDemo1.Page2"
@H_403_1216@ xmlns:x="http://scheR_585_11845@as.microsoft.com/winfx/2006/xaml" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
@H_403_1216@ Width="400" Height="300" Loaded="UserControl_Loaded">
</
Grid
>
</
UserControl
>
|
Page2.xaml.cs
|
@H_403_1216@
@H_403_1216@ public partial class Page2 : UserControl
@H_403_1216@ public Page2()
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ client.GetDataCompleted +=
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@}
|
WebDataservice1.svc.cs
|
@H_403_1216@
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@}
|
@H_580_4932@
Page3.xaml
|
<
UserControl
x
:
Class
="DBDemo1.Page3"
@H_403_1216@ xmlns:x="http://scheR_585_11845@as.microsoft.com/winfx/2006/xaml" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
@H_403_1216@ Width="400" Height="300" Loaded="UserControl_Loaded">
</
Grid
>
</
UserControl
>
|
Page3.xaml.cs
|
@H_403_1216@
@H_403_1216@ public partial class Page3 : UserControl
@H_403_1216@ public Page3()
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@}
|
Page4.xaml
|
<
UserControl
x
:
Class
="DBDemo1.Page4"
@H_403_1216@ xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
@H_403_1216@ Width="400" Height="300" Loaded="UserControl_Loaded">
</
Grid
>
</
UserControl
>
|
Page4.xaml.cs
|
@H_403_1216@
@H_403_1216@
@H_403_1216@ public partial class Page4 : UserControl
@H_403_1216@ public Page4()
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ try
@H_403_1216@ using (Stream stream = response.GetResponseStream())
@H_403_1216@ using (var store = IsolatedStorageFile.GetUserStoreForApplication())
@H_403_1216@ IsolatedStorageFileStream subDirFile =
@H_403_1216@ using(StreamReader sr = new StreamReader(stream))
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ using (var store = IsolatedStorageFile.GetUserStoreForApplication())
@H_403_1216@ IsolatedStorageFileStream subDirFile =
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@
@H_403_1216@ XDocument doc = (XDocument)state;
@H_403_1216@ ID = s1.Attribute("CUSTOMER_ID").Value,
@H_403_1216@ Name = s1.Attribute("CUSTOMER_NAME").Value
@H_403_1216@ }
@H_403_1216@ }
@H_403_1216@}
|
以上是大佬教程为你收集整理的Silverlight 2.0 資料庫應用程式開發(1)全部内容,希望文章能够帮你解决Silverlight 2.0 資料庫應用程式開發(1)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。