AccessデータのListViewでの挿入不具合の解決
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
閲覧総計:&counter(); (本日:&counter(today); 昨日...
ListViewでAccessデータに新たなデータを挿入する際、IDが...
設定されていると、「挿入」ボタンをクリックした時点で「バ...
数に Null 値を代入しようとしました。 」のエラーが出て動き...
この問題の解決方法を備忘目的で記載しておきます。(3.5) ...
【原因】
IDは「オートナンバ型」であるのに、自動生成されたInsertC...
しようとしている事がエラー発生の原因。
InsertCommand="INSERT INTO [名簿] (&color(crimson){[ID],}...
<InsertParameters>
&color(crimson){<asp:Parameter Name="ID" Type="Int3...
<asp:Parameter Name="名前" Type="String" />
<asp:Parameter Name="年齢" Type="Int16" />
</InsertParameters>
【解決方法】
InsertCommandが「ID」を更新しようとしている所の情報を削...
今回の場合は、
nsertCommandの[ID],と?,の2ヶ所を削除
<asp:Parameter Name="ID" Type="Int32" />の行を削除
でエラーは解消し、「挿入」機能が正しく動作する様になった。
InsertCommand="INSERT INTO [名簿] ([名前], [年齢]) VALUES...
<InsertParameters>
<asp:Parameter Name="名前" Type="String" />
<asp:Parameter Name="年齢" Type="Int16" />
</InsertParameters>
Accessデータベース名:MyDB.mdb
テーブル名:名簿
|~フィールド名|~データ型|~フィールドサイズ|
|ID (主キー)|オートナンバー型|長整数型|
|名前|テキスト型|50|
|年齢|数値型|整数型|
※ASP.NET3.5ではAccess2007のDBファイル形式(*.accdb)は利用...
DBファイルは「Acces2002-2003形式(*.mdb)」で保存してASP.NE...
開発環境:VWD2008
サーバ:Windows Server2003 + .NET Framework3.5
【機能】ListViewの「挿入」ボタンでAccessデータに新たなデ...
【稼働画面】
#ref(ListViewAdd.JPG);
「挿入」機能が正しく動く様になった自動生成全コード
【ListViewAdd.aspx】[3.5]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitiona...
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ListViewでのAccessデータの挿入機能の確認 09...
(ID:オートナンバー型)<br />
<br />
<asp:ListView ID="ListView1" runat="server" Data...
DataSourceID="AccessDataSource1" InsertItemP...
<ItemTemplate>
<tr style="">
<td>
</td>
<td>
<asp:Label ID="IDLabel" runat="s...
</td>
<td>
<asp:Label ID="名前Label" runat=...
</td>
<td>
<asp:Label ID="年齢Label" runat=...
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="">
<td>
</td>
<td>
<asp:Label ID="IDLabel" runat="s...
</td>
<td>
<asp:Label ID="名前Label" runat=...
</td>
<td>
<asp:Label ID="年齢Label" runat=...
</td>
</tr>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>
データは返されませんでした。...
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" ru...
<asp:Button ID="CancelButton" ru...
</td>
<td>
</td>
<td>
<asp:TextBox ID="名前TextBox" ru...
</td>
<td>
<asp:TextBox ID="年齢TextBox" ru...
</td>
</tr>
</InsertItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderCo...
<tr runat="server" style...
<th runat="server">
</th>
<th runat="server">
ID</th>
<th runat="server">
名前</th>
<th runat="server">
年齢</th>
</tr>
<tr ID="itemPlaceholder"...
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
</td>
</tr>
</table>
</LayoutTemplate>
<EditItemTemplate>
<tr style="">
<td>
<asp:Button ID="UpdateButton" ru...
<asp:Button ID="CancelButton" ru...
Text="キャンセル" />
</td>
<td>
<asp:Label ID="IDLabel1" runat="...
</td>
<td>
<asp:TextBox ID="名前TextBox" ru...
</td>
<td>
<asp:TextBox ID="年齢TextBox" ru...
</td>
</tr>
</EditItemTemplate>
<SelectedItemTemplate>
<tr style="">
<td>
</td>
<td>
<asp:Label ID="IDLabel" runat="s...
</td>
<td>
<asp:Label ID="名前Label" runat=...
</td>
<td>
<asp:Label ID="年齢Label" runat=...
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:AccessDataSource ID="AccessDataSource1" run...
DataFile="~/App_Data/MyDB.mdb" DeleteCommand...
InsertCommand="INSERT INTO [名簿] ([名前], [...
SelectCommand="SELECT [ID], [名前], [年齢] F...
UpdateCommand="UPDATE [名簿] SET [名前] = ?,...
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="名前" Type="String"...
<asp:Parameter Name="年齢" Type="Int16" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="名前" Type="String"...
<asp:Parameter Name="年齢" Type="Int16" />
</InsertParameters>
</asp:AccessDataSource>
<br />
</div>
</form>
</body>
</html>
【参考にしたページ】
1.AccsessデータにListViewで挿入できない 09/09/13
http://social.msdn.microsoft.com/Forums/ja-JP/aspnetja/th...
- http://www.coachcanadaoutlet.ca http://www.prada-outlet...
- http://www.outletonline-michaelkors.com/ http://www.mic...
- 2015-10-6 xiaozhengm http://www.louisvuitton-lvoutlet....
- http://www.cybermondaydeals.in.net http://www.michaelk...
- 20190109 junda http://www.coach-factory-outlet-online.u...
- http://www.oakleysunglassese.us.com/ http://www.oakley...
- Often http://www.louis-vuittonoutletcanada.ca/ the http...
- http://www.oakleysunglassesa.us.com/ http://www.oakley-...
- This is informative http://www.zapyapc.com/zapya-for-pc...
- http://www.outletsmichaelkors.us.com http://www.christi...
- http://www.mobogenieforpcc.com http://www.snapchatforpc...
- http://www.ucbrowserforpcc.com -- [[bvf]] &new{2016-09-...
- nice information it is.http://www.zapyapc.com/ http://...
- http://www.nike-id.us/ nike id http://www.katespadeo...
- Dailymotion video downloader Try http://dailymotionvid...
- This is really informative. https://www.imoforwindowsp...
- https://www.reallrishta.com/ -- [[https://www.reallrish...
- https://www.srsroofing.ca/ -- [[https://www.srsroofing....
- https://www.srsroofing.ca/ -- [[https://www.srsroofing....
- https://www.reallrishta.com/ -- [[https://www.reallrish...
- http://images.google.com.sb/url?q=https%3A%2F%2Fwww.srs...
- https://www.google.tg/url?q=https://www.reallrishta.co...
- http://images.google.nu/url?q=https%3A%2F%2Fwww.srsroof...
- https://www.srsroofing.ca/ -- [[https://www.srsroofing....
- Live URL https://social.msdn.microsoft.com/Profile/Payt...
#comment_nospam
#vote(参考になった[0],ふつう[0],参考にならなかった[2])
終了行:
閲覧総計:&counter(); (本日:&counter(today); 昨日...
ListViewでAccessデータに新たなデータを挿入する際、IDが...
設定されていると、「挿入」ボタンをクリックした時点で「バ...
数に Null 値を代入しようとしました。 」のエラーが出て動き...
この問題の解決方法を備忘目的で記載しておきます。(3.5) ...
【原因】
IDは「オートナンバ型」であるのに、自動生成されたInsertC...
しようとしている事がエラー発生の原因。
InsertCommand="INSERT INTO [名簿] (&color(crimson){[ID],}...
<InsertParameters>
&color(crimson){<asp:Parameter Name="ID" Type="Int3...
<asp:Parameter Name="名前" Type="String" />
<asp:Parameter Name="年齢" Type="Int16" />
</InsertParameters>
【解決方法】
InsertCommandが「ID」を更新しようとしている所の情報を削...
今回の場合は、
nsertCommandの[ID],と?,の2ヶ所を削除
<asp:Parameter Name="ID" Type="Int32" />の行を削除
でエラーは解消し、「挿入」機能が正しく動作する様になった。
InsertCommand="INSERT INTO [名簿] ([名前], [年齢]) VALUES...
<InsertParameters>
<asp:Parameter Name="名前" Type="String" />
<asp:Parameter Name="年齢" Type="Int16" />
</InsertParameters>
Accessデータベース名:MyDB.mdb
テーブル名:名簿
|~フィールド名|~データ型|~フィールドサイズ|
|ID (主キー)|オートナンバー型|長整数型|
|名前|テキスト型|50|
|年齢|数値型|整数型|
※ASP.NET3.5ではAccess2007のDBファイル形式(*.accdb)は利用...
DBファイルは「Acces2002-2003形式(*.mdb)」で保存してASP.NE...
開発環境:VWD2008
サーバ:Windows Server2003 + .NET Framework3.5
【機能】ListViewの「挿入」ボタンでAccessデータに新たなデ...
【稼働画面】
#ref(ListViewAdd.JPG);
「挿入」機能が正しく動く様になった自動生成全コード
【ListViewAdd.aspx】[3.5]
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitiona...
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ListViewでのAccessデータの挿入機能の確認 09...
(ID:オートナンバー型)<br />
<br />
<asp:ListView ID="ListView1" runat="server" Data...
DataSourceID="AccessDataSource1" InsertItemP...
<ItemTemplate>
<tr style="">
<td>
</td>
<td>
<asp:Label ID="IDLabel" runat="s...
</td>
<td>
<asp:Label ID="名前Label" runat=...
</td>
<td>
<asp:Label ID="年齢Label" runat=...
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="">
<td>
</td>
<td>
<asp:Label ID="IDLabel" runat="s...
</td>
<td>
<asp:Label ID="名前Label" runat=...
</td>
<td>
<asp:Label ID="年齢Label" runat=...
</td>
</tr>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table runat="server" style="">
<tr>
<td>
データは返されませんでした。...
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" ru...
<asp:Button ID="CancelButton" ru...
</td>
<td>
</td>
<td>
<asp:TextBox ID="名前TextBox" ru...
</td>
<td>
<asp:TextBox ID="年齢TextBox" ru...
</td>
</tr>
</InsertItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderCo...
<tr runat="server" style...
<th runat="server">
</th>
<th runat="server">
ID</th>
<th runat="server">
名前</th>
<th runat="server">
年齢</th>
</tr>
<tr ID="itemPlaceholder"...
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
</td>
</tr>
</table>
</LayoutTemplate>
<EditItemTemplate>
<tr style="">
<td>
<asp:Button ID="UpdateButton" ru...
<asp:Button ID="CancelButton" ru...
Text="キャンセル" />
</td>
<td>
<asp:Label ID="IDLabel1" runat="...
</td>
<td>
<asp:TextBox ID="名前TextBox" ru...
</td>
<td>
<asp:TextBox ID="年齢TextBox" ru...
</td>
</tr>
</EditItemTemplate>
<SelectedItemTemplate>
<tr style="">
<td>
</td>
<td>
<asp:Label ID="IDLabel" runat="s...
</td>
<td>
<asp:Label ID="名前Label" runat=...
</td>
<td>
<asp:Label ID="年齢Label" runat=...
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:AccessDataSource ID="AccessDataSource1" run...
DataFile="~/App_Data/MyDB.mdb" DeleteCommand...
InsertCommand="INSERT INTO [名簿] ([名前], [...
SelectCommand="SELECT [ID], [名前], [年齢] F...
UpdateCommand="UPDATE [名簿] SET [名前] = ?,...
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="名前" Type="String"...
<asp:Parameter Name="年齢" Type="Int16" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="名前" Type="String"...
<asp:Parameter Name="年齢" Type="Int16" />
</InsertParameters>
</asp:AccessDataSource>
<br />
</div>
</form>
</body>
</html>
【参考にしたページ】
1.AccsessデータにListViewで挿入できない 09/09/13
http://social.msdn.microsoft.com/Forums/ja-JP/aspnetja/th...
- http://www.coachcanadaoutlet.ca http://www.prada-outlet...
- http://www.outletonline-michaelkors.com/ http://www.mic...
- 2015-10-6 xiaozhengm http://www.louisvuitton-lvoutlet....
- http://www.cybermondaydeals.in.net http://www.michaelk...
- 20190109 junda http://www.coach-factory-outlet-online.u...
- http://www.oakleysunglassese.us.com/ http://www.oakley...
- Often http://www.louis-vuittonoutletcanada.ca/ the http...
- http://www.oakleysunglassesa.us.com/ http://www.oakley-...
- This is informative http://www.zapyapc.com/zapya-for-pc...
- http://www.outletsmichaelkors.us.com http://www.christi...
- http://www.mobogenieforpcc.com http://www.snapchatforpc...
- http://www.ucbrowserforpcc.com -- [[bvf]] &new{2016-09-...
- nice information it is.http://www.zapyapc.com/ http://...
- http://www.nike-id.us/ nike id http://www.katespadeo...
- Dailymotion video downloader Try http://dailymotionvid...
- This is really informative. https://www.imoforwindowsp...
- https://www.reallrishta.com/ -- [[https://www.reallrish...
- https://www.srsroofing.ca/ -- [[https://www.srsroofing....
- https://www.srsroofing.ca/ -- [[https://www.srsroofing....
- https://www.reallrishta.com/ -- [[https://www.reallrish...
- http://images.google.com.sb/url?q=https%3A%2F%2Fwww.srs...
- https://www.google.tg/url?q=https://www.reallrishta.co...
- http://images.google.nu/url?q=https%3A%2F%2Fwww.srsroof...
- https://www.srsroofing.ca/ -- [[https://www.srsroofing....
- Live URL https://social.msdn.microsoft.com/Profile/Payt...
#comment_nospam
#vote(参考になった[0],ふつう[0],参考にならなかった[2])
ページ名: