Date: prev next · Thread: first prev next last


回答ありがとうございます。
エラーが発生してしまいます。
どなたか教えていただきたいのですが。


以下の手順でテーブル、フォームを作成しました

テーブルですが
フィールド名 フィールドタイプ
ID 整数[INTEGER]
商品名 テキスト[VARCHSR]
単価 整数[INTEGER]
上記で設定しました。

フォームは
1)デザイン表示でフォームを作成を選択
2)テキストボックスを選択し二か所にテキストボックスを設置
3)右クリック フォームの属性から名前を「form」に変更
4)右クリック 属性テキストボックス 全般の名前をtextbox1~2に変更
4)右クリック 属性テキストボックス イベントからフォーカスを失った時を選択し「マクロ」クリックしてマクロ表示
上記の手順で作成しました

メールをいただいて以下実行してみました。

msgbox "sSql = "& sSql
を
ThisDataBaseDocument.DataSource.getconnection("","").createstatement.executequery(sSql)
の前に置いて、Baseからform上のtextbox1に1などIDを入れてEnterを押してみてください。

A)
以下実行してみました。

 sSql ="select ""商品名"" from ""t_test"" where ""ID"" =  '" &
oForm.getByName("textbox1").text & "';"
         msgbox(sSql) <----ここに追加
        oResult =
ThisDataBaseDocument.DataSource.getconnection("","").createstatement.executequery(sSql)

B)
結果
以下のような表示が出ました
select "商品名" from "t_test" where "ID" =  '1';

C)
このSQL文を
マイマクロ&ダイアログが開いた状態
データーフォームのtextbox1に「1」が入った状態で
フォームを選択し下記SQLを実行しました。

select "商品名" from "t_test" where "ID" =  '1';

結果
1: Wrong data type: java.lang.NumberFormatException: For input string: "1
"
上記結果となりうまくいきませんでした。
バージョンはバージョン: 5.2.6.2です
データーベースエンジンは埋め込みHSQLです

-- 
Unsubscribe instructions: E-mail to users+unsubscribe@ja.libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/ja/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.