広告に関する明記

当ブログにはアフィリエイトリンクが含まれます。

ASP.net SPREAD プログラム

SPREAD 行の操作

aspxの方で、記事欄からはみ出てるやたら長い記述がありますが、
そこは自動で作られる範囲ですので安心してください。

Default.aspx.vb

[vb]Imports System.Drawing

Namespace RowOperation

Partial Class WebForm1
Inherits System.Web.UI.Page

Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
'SPREADに最新のAccessDataSourceを連結します。
Me.FpSpread1.DataBind()
MyBase.OnPreRender(e)
End Sub

Protected Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then
' データ接続の設定を行います。
InitDBConnect()
' Spreadコントロールの初期設定を行います。
InitCntSpread()

' 各コンボボックスの初期値を設定します。
cmbCategory.SelectedIndex = 0
cmbCapacity1.SelectedIndex = 0
cmbCapacity2.SelectedIndex = 0
cmbProduction.SelectedIndex = 0

End If

End Sub

' SPREADコントロールの設定を行います。
Private Sub InitCntSpread()

' 1行おきに背景色を設定します。
FpSpread1.Sheets(0).AlternatingRows.Count = 2
' 1行目の表示色を変更します。
FpSpread1.Sheets(0).AlternatingRows(0).BackColor = Color.LightGoldenrodYellow
FpSpread1.Sheets(0).AlternatingRows(0).ForeColor = Color.Navy
' 2行目の表示色を変更します。
FpSpread1.Sheets(0).AlternatingRows(1).BackColor = Color.LightCyan
FpSpread1.Sheets(0).AlternatingRows(1).ForeColor = Color.Navy

' コマンドバーの行の追加/挿入/削除ボタンを無効に設定します。
FpSpread1.Sheets(0).AllowInsert = False
FpSpread1.Sheets(0).AllowDelete = False

' オペレーションモードを行に設定します。
FpSpread1.Sheets(0).OperationMode = FarPoint.Web.Spread.OperationMode.RowMode

' 行の選択色を変更します。
FpSpread1.Sheets(0).SelectionBackColor = Color.Pink

' コントロールで使用するフォントを設定します。
FpSpread1.Sheets(0).DefaultStyle.Font.Size = FontUnit.Small

' ページング処理に関する設定を行います。
FpSpread1.Sheets(0).PageSize = 10
FpSpread1.Pager.Align = HorizontalAlign.Right
FpSpread1.Pager.Position = FarPoint.Web.Spread.PagerPosition.TopCommandBar
FpSpread1.Pager.Mode = FarPoint.Web.Spread.PagerMode.Both
FpSpread1.Pager.Font.Bold = True
FpSpread1.Pager.BackColor = SystemColors.Control
FpSpread1.Sheets(0).PageMaxAlign = False

' ヘッダの設定を行います。
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 0).Text = "ID"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 1).Text = "商品名"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 2).Text = "内容量"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 3).Text = "原産地"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 4).Text = "製品分類"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 5).Text = "単価"
FpSpread1.Sheets(0).ColumnHeader.Cells(0, 6).Text = "在庫数"

' スタイルオブジェクトを作成します。
Dim Style As FarPoint.Web.Spread.StyleInfo = New FarPoint.Web.Spread.StyleInfo()
Style.HorizontalAlign = HorizontalAlign.Center
Style.VerticalAlign = VerticalAlign.Middle

' 各列の設定を行います。
FpSpread1.Sheets(0).DataAutoCellTypes = False
FpSpread1.Sheets(0).SetStyleInfo(-1, 0, Style)
FpSpread1.Sheets(0).Columns(0).CellType = New FarPoint.Web.Spread.IntegerCellType()
FpSpread1.Sheets(0).Columns(0).Width = 50
FpSpread1.Sheets(0).Columns(0).Locked = True

FpSpread1.Sheets(0).SetStyleInfo(-1, 1, Style)
FpSpread1.Sheets(0).Columns(1).Width = 170
FpSpread1.Sheets(0).SetStyleInfo(-1, 2, Style)
FpSpread1.Sheets(0).Columns(2).Width = 100
FpSpread1.Sheets(0).SetStyleInfo(-1, 3, Style)
FpSpread1.Sheets(0).Columns(3).Width = 80

FpSpread1.Sheets(0).SetStyleInfo(-1, 4, Style)
Dim combo As New FarPoint.Web.Spread.ComboBoxCellType(New String() {"ソフトドリンク", "ビール", "ワイン", "日本酒", "焼酎"}, New String() {"1", "2", "3", "4", "5"})
combo.ShowButton = True
combo.UseValue = True
FpSpread1.Sheets(0).Columns(4).CellType = combo
FpSpread1.Sheets(0).Columns(4).Width = 100

FpSpread1.Sheets(0).Columns(5).CellType = New FarPoint.Web.Spread.CurrencyCellType()
FpSpread1.Sheets(0).Columns(5).Width = 80

FpSpread1.Sheets(0).Columns(6).CellType = New FarPoint.Web.Spread.IntegerCellType()
FpSpread1.Sheets(0).Columns(6).Width = 80
End Sub

' データ接続の設定を行います。
Private Sub InitDBConnect()
FpSpread1.DataSourceID = AccessDataSource1.ID
End Sub

'DataSourceView.Insert処理で使用
Private Function dataSourceCallbackOnAdd(ByVal rows As Integer, ByVal e As Exception) As Boolean
If e Is Nothing Then
lblStatus.Text = "新規行を追加しました。"
Else
lblStatus.Text = "新規行を追加できませんでした:" & e.Message
End If
Return True
End Function

'DataSourceView.Delete処理で使用
Private Function dataSourceCallbackOnDelete(ByVal rows As Integer, ByVal e As Exception) As Boolean
If e Is Nothing Then
lblStatus.Text = "行を削除しました。"
Else
lblStatus.Text = "行を削除できませんでした:" & e.Message
End If
Return True
End Function

'DataSourceView.Update処理で使用
Private Function dataSourceCallbackOnUpdate(ByVal rows As Integer, ByVal e As Exception) As Boolean
If e Is Nothing Then
lblStatus.Text = "行を更新しました。"
Else
lblStatus.Text = "行を更新できませんでした:" & e.Message
End If
Return True
End Function

Protected Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

'変更を保存
FpSpread1.SaveChanges()

Dim ds As IDataSource = Me.AccessDataSource1
Dim data As Hashtable = MakeData()
Dim dsv As DataSourceView = ds.GetView(String.Empty)

'新規行を追加
dsv.Insert(data, New DataSourceViewOperationCallback(AddressOf dataSourceCallbackOnAdd))

' 最終ページを表示
Dim lastpage As Int32 = FpSpread1.Sheets(0).RowCount / FpSpread1.Sheets(0).PageSize
FpSpread1.GotoPage(lastpage)
FpSpread1.Sheets(0).ActiveRow = FpSpread1.Sheets(0).RowCount
FpSpread1.Sheets(0).ActiveColumn = 0

End Sub

Protected Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

'変更を保存
FpSpread1.SaveChanges()

Dim row As Int32 = FpSpread1.ActiveSheetView.ActiveRow

If row < 0 Then
lblStatus.Text = "削除したい行を選択して下さい。"
Exit Sub
End If

Dim ds As IDataSource = Me.AccessDataSource1
Dim dsv As DataSourceView = ds.GetView(String.Empty)

Dim keys As Hashtable = GetKeys(row)
Dim oldDatas As Hashtable = GetOldDatas(row)

'行を削除
dsv.Delete(keys, oldDatas, New DataSourceViewOperationCallback(AddressOf dataSourceCallbackOnDelete))

With FpSpread1.Sheets(0)
.SelectionModel.ClearSelection()
.ActiveRow = -1
.ActiveColumn = -1
End With

End Sub

' データベースに入力内容を反映します。
Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs)
' データを更新します。
FpSpread1.SaveChanges()
End Sub

Protected Sub FpSpread1_UpdateCommand(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SpreadCommandEventArgs) Handles FpSpread1.UpdateCommand

Dim row As Int32 = CInt(e.CommandArgument)
Dim sv As FarPoint.Web.Spread.SheetView = e.SheetView
Dim ds As IDataSource = Me.AccessDataSource1
Dim dsv As DataSourceView = ds.GetView(String.Empty)
Dim dss As FarPoint.Web.Spread.Model.IDataSourceSupport = sv.DataModel

Dim keys, newDatas, oldDatas As New Hashtable
Dim KEYCOLFIELD As String = "ID" 'データモデルのキー列名

Dim cname As String
Dim c, mc As Integer
Dim val As Object

For c = 0 To sv.ColumnCount - 1

dss = sv.DataModel
mc = sv.GetModelColumnFromViewColumn(c)
cname = dss.GetDataColumnName(mc)

If cname = KEYCOLFIELD Then
keys(cname) = sv.GetValue(row, c)
Else
val = e.EditValues(c)
If val Is FarPoint.Web.Spread.FpSpread.Unchanged Then
newDatas(cname) = sv.GetValue(row, c)
Else
newDatas(cname) = val
End If
End If

Next

oldDatas = GetOldDatas(row)

'行を更新します。
dsv.Update(keys, newDatas, oldDatas, New DataSourceViewOperationCallback(AddressOf dataSourceCallbackOnUpdate))

e.Handled = True

End Sub

' 入力を値から1行分の設定データを作成します。
Private Function MakeData() As Hashtable

Dim data As New Hashtable

data("ID") = txtID.Text
data("ProductsName") = txtProductsName.Text
data("Capacity") = cmbCapacity1.SelectedItem.Text + "×" + cmbCapacity2.SelectedItem.Text
data("Production") = cmbProduction.SelectedItem.Text
data("Category") = CStr(cmbCategory.SelectedItem.Value)
data("Price") = txtPrice.Text
data("Stock") = txtStock.Text

Return data

End Function

'指定した行のキー列(列名とデータ)を返します。
Private Function GetKeys(ByVal row As Int32) As Hashtable

Dim sv As FarPoint.Web.Spread.SheetView = FpSpread1.Sheets(0)
Dim dss As FarPoint.Web.Spread.Model.IDataSourceSupport = sv.DataModel

Dim keys As New Hashtable
Dim KEYCOLFIELD As String = "ID" 'データモデルのキー列名

Dim cname As String
Dim c, mc As Integer
For c = 0 To sv.ColumnCount - 1
mc = sv.GetModelColumnFromViewColumn(c)
cname = dss.GetDataColumnName(mc)

If cname = KEYCOLFIELD Then
keys(cname) = CStr(sv.GetValue(row, c))
Exit For
End If
Next

Return keys

End Function

'指定した行のキー以外の列(列名とデータ)を返します。
Private Function GetOldDatas(ByVal row As Int32) As Hashtable

Dim sv As FarPoint.Web.Spread.SheetView = FpSpread1.Sheets(0)
Dim dss As FarPoint.Web.Spread.Model.IDataSourceSupport = sv.DataModel

Dim oldDatas As New Hashtable
Dim KEYCOLFIELD As String = "ID" 'データモデルのキー列名

Dim cname As String
Dim c, mc As Integer
For c = 0 To sv.ColumnCount - 1
mc = sv.GetModelColumnFromViewColumn(c)
cname = dss.GetDataColumnName(mc)

If Not cname = KEYCOLFIELD Then
oldDatas(cname) = CStr(sv.GetValue(row, c))
End If
Next

Return oldDatas

End Function

End Class

End Namespace
[/vb]

Default.aspx

[html]<%@ Register TagPrefix="farpoint" Namespace="FarPoint.Web.Spread" Assembly="FarPoint.Web.SpreadJ" %>
<%@ Page Language="vb" AutoEventWireup="false" Inherits="RowOperation.WebForm1" CodeFile="default.aspx.vb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Row Operation</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:label id="lblTitle" runat="server" Width="226px" Height="23px" Font-Size="Medium" Font-Bold="True">行の操作</asp:label><br />
<br />
<asp:Label id="lblSummary" runat="server" Width="707px" Height="22px" Font-Size="Small">本サンプルでは、データ連結している場合にコードで行を追加/削除する方法を示します。</asp:Label>
<br />
<br />
<table style="position: static">
<tr>
<td><asp:Button id="btnAdd" runat="server" Width="152px" Height="25px" Text="新規行の追加" OnClick="btnAdd_Click"></asp:Button></td>
<td><asp:Label id="lblID" runat="server" Width="56px" Height="16px" Font-Size="Small">製品ID</asp:Label></td>
<td><asp:TextBox id="txtID" runat="server" Width="128px" Height="20px" Font-Size="Small">105</asp:TextBox></td>
<td><asp:Label id="lblProduction" runat="server" Width="48px" Height="16px" Font-Size="Small">原産地</asp:Label></td>
<td>
<asp:DropDownList id="cmbProduction" runat="server" Width="128px" Height="25px" Font-Size="Small">
<asp:ListItem Value="北海道">北海道</asp:ListItem>
<asp:ListItem Value="秋田">秋田</asp:ListItem>
<asp:ListItem Value="宮城">宮城</asp:ListItem>
<asp:ListItem Value="東京">東京</asp:ListItem>
<asp:ListItem Value="埼玉">埼玉</asp:ListItem>
<asp:ListItem Value="大阪">大阪</asp:ListItem>
<asp:ListItem Value="上海">上海</asp:ListItem>
<asp:ListItem Value="西安">西安</asp:ListItem>
<asp:ListItem Value="モンゴル">モンゴル</asp:ListItem>
<asp:ListItem Value="インド">インド</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td><asp:Button id="btnDelete" runat="server" Width="152px" Height="25px" Text="行の削除" OnClick="btnDelete_Click"></asp:Button></td>
<td><asp:Label id="lblProductsName" runat="server" Width="56px" Height="16px" Font-Size="Small">製品名</asp:Label></td>
<td><asp:TextBox id="txtProductsName" runat="server" Width="128px" Height="20px" Font-Size="Small">ブルーベリードリンク</asp:TextBox></td>
<td><asp:Label id="lblCategory" runat="server" Width="56px" Height="16px" Font-Size="Small">製品分類</asp:Label></td>
<td>
<asp:DropDownList id="cmbCategory" runat="server" Width="128px" Height="25px" Font-Size="Small">
<asp:ListItem Value="1">ソフトドリンク</asp:ListItem>
<asp:ListItem Value="2">ビール</asp:ListItem>
<asp:ListItem Value="3">ワイン</asp:ListItem>
<asp:ListItem Value="4">日本酒</asp:ListItem>
<asp:ListItem Value="5">焼酎</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td><asp:Button id="btnUpdate" runat="server" Width="152px" Height="25px" Text="データを更新" OnClick="btnUpdate_Click"></asp:Button></td>
<td><asp:Label id="lblCapacity" runat="server" Width="72px" Height="16px" Font-Size="Small">製品内容量</asp:Label></td>
<td><asp:DropDownList id="cmbCapacity1" runat="server" Width="128px" Height="25px" Font-Size="Small">
<asp:ListItem Value="180ml">180ml</asp:ListItem>
<asp:ListItem Value="350ml">350ml</asp:ListItem>
<asp:ListItem Value="500ml">500ml</asp:ListItem>
<asp:ListItem Value="750ml">750ml</asp:ListItem>
<asp:ListItem Value="1L">1L</asp:ListItem>
<asp:ListItem Value="1.5L">1.5L</asp:ListItem>
<asp:ListItem Value="1升瓶">1升瓶</asp:ListItem>
<asp:ListItem Value="2L">2L</asp:ListItem>
</asp:DropDownList></td>
<td><asp:Label id="lblPrice" runat="server" Width="56px" Height="16px" Font-Size="Small">製品単価</asp:Label></td>
<td><asp:TextBox id="txtPrice" runat="server" Width="128px" Height="20px" Font-Size="Small">1500</asp:TextBox></td>
</tr>
<tr>
<td></td>
<td></td>
<td><asp:DropDownList id="cmbCapacity2" runat="server" Width="128px" Height="25px" Font-Size="Small">
<asp:ListItem Value="5本">5本</asp:ListItem>
<asp:ListItem Value="6本">6本</asp:ListItem>
<asp:ListItem Value="10本">10本</asp:ListItem>
<asp:ListItem Value="1ダース">1ダース</asp:ListItem>
</asp:DropDownList></td>
<td><asp:Label id="lblStock" runat="server" Width="48px" Height="16px" Font-Size="Small">在庫</asp:Label></td>
<td><asp:TextBox id="txtStock" runat="server" Width="128px" Height="20px" Font-Size="Small">50</asp:TextBox></td>
</tr>
</table>
<br />

<FarPoint:FpSpread id="FpSpread1" runat="server" DesignString='<?xml version="1.0" encoding="utf-8"?><Spread />' Width="711px" Height="290px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ActiveSheetViewIndex="0">
<Sheets>
<farpoint:SheetView DesignString="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;Sheet&gt;&lt;Data&gt;&lt;RowHeader class=&quot;FarPoint.Web.Spread.Model.DefaultSheetDataModel&quot; rows=&quot;3&quot; columns=&quot;1&quot;&gt;&lt;AutoCalculation&gt;True&lt;/AutoCalculation&gt;&lt;AutoGenerateColumns&gt;True&lt;/AutoGenerateColumns&gt;&lt;ReferenceStyle&gt;A1&lt;/ReferenceStyle&gt;&lt;Iteration&gt;False&lt;/Iteration&gt;&lt;MaximumIterations&gt;1&lt;/MaximumIterations&gt;&lt;MaximumChange&gt;0.001&lt;/MaximumChange&gt;&lt;SheetName /&gt;&lt;/RowHeader&gt;&lt;ColumnHeader class=&quot;FarPoint.Web.Spread.Model.DefaultSheetDataModel&quot; rows=&quot;1&quot; columns=&quot;7&quot;&gt;&lt;AutoCalculation&gt;True&lt;/AutoCalculation&gt;&lt;AutoGenerateColumns&gt;True&lt;/AutoGenerateColumns&gt;&lt;ReferenceStyle&gt;A1&lt;/ReferenceStyle&gt;&lt;Iteration&gt;False&lt;/Iteration&gt;&lt;MaximumIterations&gt;1&lt;/MaximumIterations&gt;&lt;MaximumChange&gt;0.001&lt;/MaximumChange&gt;&lt;SheetName /&gt;&lt;/ColumnHeader&gt;&lt;DataArea class=&quot;FarPoint.Web.Spread.Model.DefaultSheetDataModel&quot; rows=&quot;3&quot; columns=&quot;7&quot;&gt;&lt;AutoCalculation&gt;True&lt;/AutoCalculation&gt;&lt;AutoGenerateColumns&gt;True&lt;/AutoGenerateColumns&gt;&lt;DataKeyField class=&quot;System.String[]&quot; assembly=&quot;mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;&gt;AAEAAAD/////AQAAAAAAAAARAQAAAAAAAAAL&lt;/DataKeyField&gt;&lt;ReferenceStyle&gt;A1&lt;/ReferenceStyle&gt;&lt;Iteration&gt;False&lt;/Iteration&gt;&lt;MaximumIterations&gt;1&lt;/MaximumIterations&gt;&lt;MaximumChange&gt;0.001&lt;/MaximumChange&gt;&lt;SheetName&gt;Sheet1&lt;/SheetName&gt;&lt;RowIndexes class=&quot;System.Collections.ArrayList&quot; assembly=&quot;mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;&gt;AAEAAAD/////AQAAAAAAAAAEAQAAABxTeXN0ZW0uQ29sbGVjdGlvbnMuQXJyYXlMaXN0AwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24FAAAICAkCAAAAAwAAADIAAAAQAgAAAAQAAAAICAAAAAAICAEAAAAICAIAAAAKCw==&lt;/RowIndexes&gt;&lt;/DataArea&gt;&lt;/Data&gt;&lt;Presentation&gt;&lt;AxisModels&gt;&lt;Column class=&quot;FarPoint.Web.Spread.Model.DefaultSheetAxisModel&quot; defaultSize=&quot;90&quot; orientation=&quot;Horizontal&quot; count=&quot;7&quot;&gt;&lt;Items&gt;&lt;Item index=&quot;-1&quot;&gt;&lt;Size&gt;90&lt;/Size&gt;&lt;SortIndicator&gt;Ascending&lt;/SortIndicator&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/Column&gt;&lt;RowHeaderColumn class=&quot;FarPoint.Web.Spread.Model.DefaultSheetAxisModel&quot; defaultSize=&quot;40&quot; orientation=&quot;Horizontal&quot; count=&quot;1&quot;&gt;&lt;Items&gt;&lt;Item index=&quot;-1&quot;&gt;&lt;Size&gt;40&lt;/Size&gt;&lt;SortIndicator&gt;Ascending&lt;/SortIndicator&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/RowHeaderColumn&gt;&lt;ColumnHeaderRow class=&quot;FarPoint.Web.Spread.Model.DefaultSheetAxisModel&quot; defaultSize=&quot;22&quot; orientation=&quot;Vertical&quot; count=&quot;1&quot;&gt;&lt;Items&gt;&lt;Item index=&quot;-1&quot;&gt;&lt;Size&gt;22&lt;/Size&gt;&lt;/Item&gt;&lt;/Items&gt;&lt;/ColumnHeaderRow&gt;&lt;/AxisModels&gt;&lt;StyleModels&gt;&lt;RowHeader class=&quot;FarPoint.Web.Spread.Model.DefaultSheetStyleModel&quot; Rows=&quot;3&quot; Columns=&quot;1&quot;&gt;&lt;AltRowCount&gt;2&lt;/AltRowCount&gt;&lt;DefaultStyle class=&quot;FarPoint.Web.Spread.NamedStyle&quot; Parent=&quot;HeaderDefault&quot; /&gt;&lt;/RowHeader&gt;&lt;ColumnHeader class=&quot;FarPoint.Web.Spread.Model.DefaultSheetStyleModel&quot; Rows=&quot;1&quot; Columns=&quot;7&quot;&gt;&lt;AltRowCount&gt;2&lt;/AltRowCount&gt;&lt;DefaultStyle class=&quot;FarPoint.Web.Spread.NamedStyle&quot; Parent=&quot;HeaderDefault&quot; /&gt;&lt;/ColumnHeader&gt;&lt;DataArea class=&quot;FarPoint.Web.Spread.Model.DefaultSheetStyleModel&quot; Rows=&quot;3&quot; Columns=&quot;7&quot;&gt;&lt;AltRowCount&gt;2&lt;/AltRowCount&gt;&lt;DefaultStyle class=&quot;FarPoint.Web.Spread.NamedStyle&quot; Parent=&quot;DataAreaDefault&quot; /&gt;&lt;ColumnStyles&gt;&lt;ColumnStyle Index=&quot;0&quot; class=&quot;FarPoint.Web.Spread.StyleInfo&quot;&gt;&lt;CellType class=&quot;FarPoint.Web.Spread.IntegerCellType&quot;&gt;&lt;ErrorMsg&gt;整数型: (ex, 123)&lt;/ErrorMsg&gt;&lt;AllowWrap&gt;False&lt;/AllowWrap&gt;&lt;IsDateFormat&gt;False&lt;/IsDateFormat&gt;&lt;GeneralCellType /&gt;&lt;IntegerCellType /&gt;&lt;/CellType&gt;&lt;/ColumnStyle&gt;&lt;ColumnStyle Index=&quot;4&quot; class=&quot;FarPoint.Web.Spread.StyleInfo&quot;&gt;&lt;CellType class=&quot;FarPoint.Web.Spread.IntegerCellType&quot;&gt;&lt;ErrorMsg&gt;整数型: (ex, 123)&lt;/ErrorMsg&gt;&lt;AllowWrap&gt;False&lt;/AllowWrap&gt;&lt;IsDateFormat&gt;False&lt;/IsDateFormat&gt;&lt;GeneralCellType /&gt;&lt;IntegerCellType /&gt;&lt;/CellType&gt;&lt;/ColumnStyle&gt;&lt;ColumnStyle Index=&quot;5&quot; class=&quot;FarPoint.Web.Spread.StyleInfo&quot;&gt;&lt;CellType class=&quot;FarPoint.Web.Spread.IntegerCellType&quot;&gt;&lt;ErrorMsg&gt;整数型: (ex, 123)&lt;/ErrorMsg&gt;&lt;AllowWrap&gt;False&lt;/AllowWrap&gt;&lt;IsDateFormat&gt;False&lt;/IsDateFormat&gt;&lt;GeneralCellType /&gt;&lt;IntegerCellType /&gt;&lt;/CellType&gt;&lt;/ColumnStyle&gt;&lt;ColumnStyle Index=&quot;6&quot; class=&quot;FarPoint.Web.Spread.StyleInfo&quot;&gt;&lt;CellType class=&quot;FarPoint.Web.Spread.IntegerCellType&quot;&gt;&lt;ErrorMsg&gt;整数型: (ex, 123)&lt;/ErrorMsg&gt;&lt;AllowWrap&gt;False&lt;/AllowWrap&gt;&lt;IsDateFormat&gt;False&lt;/IsDateFormat&gt;&lt;GeneralCellType /&gt;&lt;IntegerCellType /&gt;&lt;/CellType&gt;&lt;/ColumnStyle&gt;&lt;/ColumnStyles&gt;&lt;/DataArea&gt;&lt;/StyleModels&gt;&lt;MessageRowStyle class=&quot;FarPoint.Web.Spread.Appearance&quot;&gt;&lt;BackColor&gt;LightYellow&lt;/BackColor&gt;&lt;ForeColor&gt;Red&lt;/ForeColor&gt;&lt;/MessageRowStyle&gt;&lt;SheetCornerStyle class=&quot;FarPoint.Web.Spread.NamedStyle&quot; Parent=&quot;HeaderDefault&quot; /&gt;&lt;TopRow&gt;0&lt;/TopRow&gt;&lt;/Presentation&gt;&lt;/Sheet&gt;" SheetName="Sheet1" DataSourceID="(なし)">
<RowHeader Width="40"></RowHeader>
<SelectionBorder BorderStyle="NotSet" BorderStyleBottom="NotSet" BorderStyleLeft="NotSet"
BorderStyleRight="NotSet" BorderStyleTop="NotSet" />
</farpoint:SheetView>
</Sheets>
</FarPoint:FpSpread><br />

<asp:Label id="lblStatus" runat="server" Width="714px" Height="74px" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" BackColor="Control" Font-Size="Small"></asp:Label>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" ConflictDetection="CompareAllValues" DataFile="~/App_Data/SpreadSample.mdb" DeleteCommand="DELETE FROM [Products] WHERE [ID] = ? AND [ProductsName] = ? AND [Capacity] = ? AND [Production] = ? AND [Category] = ? AND [Price] = ? AND [Stock] = ?" InsertCommand="INSERT INTO [Products] ([ID], [ProductsName], [Capacity], [Production], [Category], [Price], [Stock]) VALUES (?, ?, ?, ?, ?, ?, ?)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Products]" UpdateCommand="UPDATE [Products] SET [ProductsName] = ?, [Capacity] = ?, [Production] = ?, [Category] = ?, [Price] = ?, [Stock] = ? WHERE [ID] = ? AND [ProductsName] = ? AND [Capacity] = ? AND [Production] = ? AND [Category] = ? AND [Price] = ? AND [Stock] = ?">
<DeleteParameters>
<asp:Parameter Name="original_ID" Type="Int32" />
<asp:Parameter Name="original_ProductsName" Type="String" />
<asp:Parameter Name="original_Capacity" Type="String" />
<asp:Parameter Name="original_Production" Type="String" />
<asp:Parameter Name="original_Category" Type="Int32" />
<asp:Parameter Name="original_Price" Type="Int32" />
<asp:Parameter Name="original_Stock" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ProductsName" Type="String" />
<asp:Parameter Name="Capacity" Type="String" />
<asp:Parameter Name="Production" Type="String" />
<asp:Parameter Name="Category" Type="Int32" />
<asp:Parameter Name="Price" Type="Int32" />
<asp:Parameter Name="Stock" Type="Int32" />
<asp:Parameter Name="original_ID" Type="Int32" />
<asp:Parameter Name="original_ProductsName" Type="String" />
<asp:Parameter Name="original_Capacity" Type="String" />
<asp:Parameter Name="original_Production" Type="String" />
<asp:Parameter Name="original_Category" Type="Int32" />
<asp:Parameter Name="original_Price" Type="Int32" />
<asp:Parameter Name="original_Stock" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="ProductsName" Type="String" />
<asp:Parameter Name="Capacity" Type="String" />
<asp:Parameter Name="Production" Type="String" />
<asp:Parameter Name="Category" Type="Int32" />
<asp:Parameter Name="Price" Type="Int32" />
<asp:Parameter Name="Stock" Type="Int32" />
</InsertParameters>
</asp:AccessDataSource>

</form>
</body>
</html>
[/html]

にほんブログ村 IT技術ブログ プログラム・プログラマーへ
にほんブログ村

ランキング参加中
にほんブログ村
GMOブログセンター
CoRichブログランキング
ビジネスブログ100選

-ASP.net, SPREAD, プログラム
-, , ,