DHJJ DHJJ [Hatsune's Journal Japan]

VS2010 De Oracle

VS2010 De Oracle

01

ODAC with Visual Studio

ODAC 11g Beta 11.2.0.1.1
http://www.oracle.com/technology/software/tech/windows/odpnet/index112011beta.html
ODP.NET 11.2.0.1.1
.NET Framework 4 and .NET Framework 4 Client Profile support
ODT 11.2.0.1.1
supporting Visual Studio 2010, Visual Studio 2008, and Visual Studio 2005
Oracle Providers for ASP.NET
ASP.NET 4 support

04

Oracle Data Provider for .NET

Oracle用データプロバイダー

05

ADO.NETと同じ構造

06

2.112.1.1と4.112.1.1

07

サンプルコード
Const cnString As String = "User Id={0};Password={1};Data Source={2}"
Me.Cursor = Cursors.WaitCursor
Using _cn As New Oracle.DataAccess.Client.OracleConnection
    Try
        _cn.ConnectionString = String.Format(cnString,
                                             Me.UserID_TextBox.Text,
                                             Me.Password_TextBox.Text,
                                             Me.Service_TextBox.Text)
        _cn.Open()
        MessageBox.Show("接続成功")
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    Finally
        Me.Cursor = Cursors.Default
    End Try
End Using
ODP.NET(コネクションプーリング)

必要なときだけ接続で問題ない

09

10

ODT

サーバーエクスプローラー

11

プロジェクトデータソース

12

データソースからDrag&Drop

13

    Private Sub DragDrop_Form1_Load(ByVal sender As Object,
                                    ByVal e As EventArgs) _
                                    Handles MyBase.Load
        Using _cn As New OracleConnection
            _cn.ConnectionString = My.Settings.ConnectionString & "Password=tiger;"
            Me.EMPTableAdapter.Connection = _cn
            Me.EMPTableAdapter.Fill(Me.DataSet1.EMP)
        End Using
    End Sub
    Private Sub EMPBindingNavigatorSaveItem_Click(ByVal sender As Object,
                                                  ByVal e As EventArgs) _
                                                  Handles EMPBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.EMPBindingSource.EndEdit()
        Using _cn As New OracleConnection
            _cn.ConnectionString = My.Settings.ConnectionString & "Password=tiger;"
            Me.TableAdapterManager.Connection = _cn
            Me.TableAdapterManager.UpdateAll(Me.DataSet1)
        End Using
    End Sub

データアクセス部分の分離

15

WEBサービスとして独立

16

ASP.NET MVC2

MVCとは

17

ASP.NET MVC2の流れ

18

Windows Phone

Windows Phone + XML WebService

19

エミュレーターによる実行

20

COPYRIGHT (C) 2008 初音玲 All rights reserved. / Running .NET Framework 4.0.30319.42000