tagCANDY CGI VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
VBレスキュー(花ちゃん) の Visual Basic 2010 用 掲示板(VB.NET 掲示板)
[ツリー表示へ]  [ワード検索]  [Home]

タイトル Re^13: バイナリデータが切り捨てられます。no
投稿日: 2007/08/27(Mon) 15:50
投稿者kokoro
> >                 Sql &= "INSERT INTO "
> >                 Sql &= "個人情報 "
> >                 Sql &= "("
> >                 Sql &= "ID" & ", "
> >                 Sql &= "姓" & ") "
> >                 Sql &= "名" & ", "
> >                 Sql &= "性別" & ", "
> >                 Sql &= "生年月日元号" & ", "
> >                 Sql &= "生年月日年" & ", "
> >                 Sql &= "生年月日西暦" & ", "
> >                 Sql &= "生年月日月" & ", "
> >                 Sql &= "生年月日日" & ", "
> >                 Sql &= "郵便1" & ", "
> >                 Sql &= "郵便2" & ", "
> >                 Sql &= "住所1" & ", "
> >                 Sql &= "住所2" & ", "
> >                 Sql &= "方書" & ", "
> >                 Sql &= "TEL" & ", "
> >                 Sql &= "携帯電話" & ", "
> >                 Sql &= "Mailadress" & ") "
> >                 Sql &= "VALUES "
> >                 Sql &= "("
> >                 Sql &= "'" & idNo & "'" & ", "
> >                 Sql &= "'" & sei & "'" & ", "
> >                 Sql &= "'" & mei & "'" & ", "
> >                 Sql &= "'" & seibetu & "'" & ", "
> >                 Sql &= "'" & seinengen & "'" & ", "
> >                 Sql &= "'" & seinennen & "'" & ", "
> >                 Sql &= "'" & seinentuki & "'" & ", "
> >                 Sql &= "'" & seinenhi & "'" & ", "
> >                 Sql &= "'" & yubin1 & "'" & ", "
> >                 Sql &= "'" & yubin2 & "'" & ", "
> >                 Sql &= "'" & jusho1 & "'" & ", "
> >                 Sql &= "'" & jusho2 & "'" & ", "
> >                 Sql &= "'" & kata & "'" & ", "
> >                 Sql &= "'" & tele & "'" & ", "
> >                 Sql &= "'" & keitai & "'" & ", "
> >                 Sql &= "'" & faxNO & "'" & ", "
> >                 Sql &= "'" & mail & "'"
> >                 Sql &= ")"
>
> これもSQLの文法的におかしくないですか?
> 文法的な問題が全て解消されても同様のエラーが出るなら
> 各変数に入っている値に問題があることになると思いますよ。
> 型が違うとか桁が溢れてるとか、文字数が長すぎるとか。

練習問題です。これが登録ボタン押下の全コードです。

   Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim datatable As DataTable

        'strMode = "登録"


        If CDbl(Mode) = 1 Then



            Me.TextBox1.Text = Code

            Me.TextBox1.Text = ""
            Me.TextBox2.Text = ""
            Me.TextBox3.Text = ""
            Me.TextBox4.Text = ""
            Me.TextBox5.Text = ""
            Me.TextBox6.Text = ""
            Me.TextBox7.Text = ""
            Me.TextBox8.Text = ""
            Me.TextBox9.Text = ""
            Me.TextBox10.Text = ""
            Me.TextBox11.Text = ""
            Me.TextBox12.Text = ""
            Me.TextBox13.Text = ""
            Me.TextBox14.Text = ""
            Me.TextBox15.Text = ""
            Me.TextBox16.Text = ""
            Me.TextBox17.Text = ""
            Me.TextBox18.Text = ""



            TextBox1.Text = "修正"
            strMode = "修正"
            Sql = ""
            Sql &= "SELECT "
            Sql &= " " & "ID" & ","
            Sql &= " " & "姓" & "," 'ここまでテスト済
            Sql &= " " & "名" & ","
            Sql &= " " & "性別" & ","
            Sql &= " " & "生年月日元号" & ","
            Sql &= " " & "生年月日年" & ","
            Sql &= " " & "生年月日西暦" & ","
            Sql &= " " & "生年月日月" & ","
            Sql &= " " & "生年月日日" & ","
            Sql &= " " & "郵便1" & ","
            Sql &= " " & "郵便2" & ","
            Sql &= " " & "住所1" & ","
            Sql &= " " & "住所2" & ","
            Sql &= " " & "方書" & ","
            Sql &= " " & "TEL" & ","
            Sql &= " " & "携帯電話" & ","
            Sql &= " " & "FAX" & ","
            Sql &= " " & "Mailadress"
            Sql &= " " & "From"
            Sql &= " " & "個人情報"
            Sql &= " " & "WHERE"
            Sql &= " " & "("
            Sql &= " " & "ID"
            Sql &= " " & "="
            Sql &= "'" & Mid(CStr(Code), 1, 3) & "'" & ")"
      
            datatable = New DataTable

            If Not dbSelect(Sql, datatable) Then
                MsgBox("Access失敗", MsgBoxStyle.Exclamation, "個人情報修正")
            Else




                Dim idNo As Integer
                Dim sei As String
                Dim mei As String
                Dim seibetu As String

                Dim seinengen As String
                Dim seinennen As Integer
                Dim seireki As Integer
                Dim seinentuki As Integer
                Dim seinenhi As Integer
                Dim yubin1 As String
                Dim yubin2 As String
                Dim jusho1 As String
                Dim jusho2 As String
                Dim kata As String
                Dim tele As String
                Dim keitai As String
                Dim faxNO As String
                Dim mail As String

                Dim Msg As String = "登録"
                If Not IsCheckInPut(Msg) Then
                    MsgBox(Msg, MsgBoxStyle.Exclamation, "入力チェック")
                    Exit Sub


                    Answer = MsgBox(strMode & "登録しますか?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, strMode & "処理")
                    If Answer = MsgBoxResult.Yes Then

                    End If


                    idNo = CInt(Me.TextBox1.Text)

                    sei = Me.TextBox2.Text
                    mei = Me.TextBox3.Text
                    seibetu = Me.TextBox4.Text
                    seinengen = Me.TextBox5.Text
                    seinennen = CInt(CStr(CInt(Me.TextBox6.Text)))
                    seireki = CInt(Me.TextBox7.Text)
                    seinentuki = CInt(Me.TextBox8.Text)
                    seinenhi = CInt(Me.TextBox9.Text)
                    yubin1 = Me.TextBox10.Text
                    yubin2 = Me.TextBox11.Text
                    jusho1 = Me.TextBox12.Text
                    jusho2 = Me.TextBox13.Text
                    kata = Me.TextBox14.Text
                    tele = Me.TextBox15.Text
                    keitai = Me.TextBox16.Text
                    faxNO = Me.TextBox17.Text
                    mail = Me.TextBox18.Text

                    If CDbl(Mode) = 0 Then


                        Me.TextBox1.Enabled = True
                        Me.TextBox2.Text = ""

                        Me.TextBox2.Text = ""
                        Me.TextBox3.Text = ""
                        Me.TextBox4.Text = ""
                        Me.TextBox5.Text = ""
                        Me.TextBox6.Text = ""
                        Me.TextBox7.Text = ""
                        Me.TextBox8.Text = ""
                        Me.TextBox9.Text = ""
                        Me.TextBox10.Text = ""
                        Me.TextBox11.Text = ""
                        Me.TextBox12.Text = ""
                        Me.TextBox13.Text = ""
                        Me.TextBox14.Text = ""
                        Me.TextBox15.Text = ""
                        Me.TextBox16.Text = ""
                        Me.TextBox17.Text = ""
                        Me.TextBox18.Text = ""


                        Sql = ""
                        Sql &= "INSERT INTO "
                        Sql &= "個人情報 "
                        Sql &= "("
                        Sql &= "ID" & ", "
                        Sql &= "姓" & ", "  'ここまでテスト済
                        Sql &= "名" & ", "
                        Sql &= "性別" & ", "
                        Sql &= "生年月日元号" & ", "
                        Sql &= "生年月日年" & ", "
                        Sql &= "生年月日西暦" & ", "
                        Sql &= "生年月日月" & ", "
                        Sql &= "生年月日日" & ", "
                        Sql &= "郵便1" & ", "
                        Sql &= "郵便2" & ", "
                        Sql &= "住所1" & ", "
                        Sql &= "住所2" & ", "
                        Sql &= "方書" & ", "
                        Sql &= "TEL" & ", "
                        Sql &= "携帯電話" & ", "
                        Sql &= "Mailadress" & ") "
                        Sql &= "VALUES "
                        Sql &= "("
                        Sql &= "'" & idNo & "'" & ", "
                        Sql &= "'" & sei & "'" & ", "    'ここまでテスト済
                        Sql &= "'" & mei & "'" & ", "
                        Sql &= "'" & seibetu & "'" & ", "
                        Sql &= "'" & seinengen & "'" & ", "
                        Sql &= "'" & seinennen & "'" & ", "
                        Sql &= "'" & seinentuki & "'" & ", "
                        Sql &= "'" & seinenhi & "'" & ", "
                        Sql &= "'" & yubin1 & "'" & ", "
                        Sql &= "'" & yubin2 & "'" & ", "
                        Sql &= "'" & jusho1 & "'" & ", "
                        Sql &= "'" & jusho2 & "'" & ", "
                        Sql &= "'" & kata & "'" & ", "
                        Sql &= "'" & tele & "'" & ", "
                        Sql &= "'" & keitai & "'" & ", "
                        Sql &= "'" & faxNO & "'" & ", "
                        Sql &= "'" & mail & "'"
                        Sql &= ")"

                    Else
                        Sql = ""
                        Sql &= "UPDATE"
                        Sql &= " " & "個人情報"
                        Sql &= " " & "SET"
                        Sql &= " " & "ID " & "= "
                        Sql &= "'" & idNo & "'" & ","
                        Sql &= " " & "姓 " & "= "
                        Sql &= "'" & sei & "'" & ","  'ここまでテスト済
                        Sql &= " " & "名 " & "= "
                        Sql &= "'" & mei & "'" & ","
                        Sql &= " " & "性別 " & "= "
                        Sql &= "'" & seibetu & "'" & ","
                        Sql &= " " & "生年月日元号 " & "= "
                        Sql &= "'" & seinengen & "'" & ","
                        Sql &= " " & "生年月日年 " & "= "
                        Sql &= "'" & seinennen & "'" & ","
                        Sql &= " " & "生年月日西暦 " & "= "
                        Sql &= "'" & seireki & "'" & ","
                        Sql &= " " & "生年月日月 " & "= "
                        Sql &= "'" & seinentuki & "'" & ","
                        Sql &= " " & "生年月日日 " & "= "
                        Sql &= "'" & seinenhi & "'" & ","
                        Sql &= " " & "郵便1 " & "= "
                        Sql &= "'" & yubin1 & "'" & ","
                        Sql &= " " & "郵便2 " & "= "
                        Sql &= "'" & yubin2 & "'" & ","
                        Sql &= " " & "住所1 " & "= "
                        Sql &= "'" & jusho1 & "'" & ","
                        Sql &= " " & "住所2 " & "= "
                        Sql &= "'" & jusho2 & "'" & ","
                        Sql &= " " & "方書 " & "= "
                        Sql &= "'" & kata & "'" & ","
                        Sql &= " " & "TEL " & "= "
                        Sql &= "'" & tele & "'" & ","
                        Sql &= " " & "携帯電話 " & "= "
                        Sql &= "'" & keitai & "'" & ","
                        Sql &= " " & "FAX " & "= "
                        Sql &= "'" & faxNO & "'" & ","
                        Sql &= " " & "Mailadress " & "= "
                        Sql &= "'" & mail & "'"
                        Sql &= " " & "WHERE " & "("
                        Sql &= " " & "ID"
                        Sql &= " " & "="
                        Sql &= "'" & Mid(CStr(Code), 3, 1) & "'" & ")" '?


                    End If

                    Try
                        dbUpdate(Sql)

                        MsgBox(strMode & "しました", MsgBoxStyle.Information, "strMode" & "処理")
                        Form3.Show()
                        Me.Close()

                    Catch ex As Exception
                        MsgBox(strMode & "に失敗しました", MsgBoxStyle.Exclamation, strMode & "処理")

                    End Try


                    dbUpdate(Sql)
                    datatable = New DataTable


                    Me.TextBox1.Text = CStr(datatable.Rows(0).Item(0))
                    Me.TextBox2.Text = CStr(datatable.Rows(0).Item(1))
                    Me.TextBox3.Text = CStr(datatable.Rows(0).Item(2))
                    Me.TextBox4.Text = CStr(datatable.Rows(0).Item(3))
                    Me.TextBox5.Text = CStr(datatable.Rows(0).Item(4))
                    Me.TextBox6.Text = CStr(datatable.Rows(0).Item(5))
                    Me.TextBox7.Text = CStr(datatable.Rows(0).Item(6))
                    Me.TextBox8.Text = CStr(datatable.Rows(0).Item(7))
                    Me.TextBox9.Text = CStr(datatable.Rows(0).Item(8))
                    Me.TextBox10.Text = CStr(datatable.Rows(0).Item(9))
                    Me.TextBox11.Text = CStr(datatable.Rows(0).Item(10))
                    Me.TextBox12.Text = CStr(datatable.Rows(0).Item(11))
                    Me.TextBox13.Text = CStr(datatable.Rows(0).Item(12))
                    Me.TextBox14.Text = CStr(datatable.Rows(0).Item(13))
                    Me.TextBox15.Text = CStr(datatable.Rows(0).Item(14))
                    Me.TextBox16.Text = CStr(datatable.Rows(0).Item(15))
                    Me.TextBox17.Text = CStr(datatable.Rows(0).Item(16))
                    Me.TextBox18.Text = CStr(datatable.Rows(0).Item(17))

                    MessageBox.Show("インデックス", Code)  'Code



    

                End If
            End If
        End If


    End Sub

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。