Incorrect syntax near '@BankAccountDetail' RRS feed

  • Question

  • hi dear

    my codes are:

       Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
            If Check_Control() = False Then Exit Sub
            Using Cmd As New SqlClient.SqlCommand("Insert Into BankAccount VALUES (@BankAccountId,@BankBranchRef,@CompanyRef,@TafsilKindRef,@BankAccountDetail ", Cn)
                With Cmd
                    If Cn.State = ConnectionState.Closed Then Cn.Open()
                    .Parameters.AddWithValue("@BankAccountId", GetLastCode)
                    .Parameters.AddWithValue("@BankBranchRef", CboBranch.SelectedValue)
                    .Parameters.AddWithValue("@CompanyRef", Mid(intYearsRef, 5))
                    .Parameters.AddWithValue("@TafsilKindRef", 3)
                    If Cn.State = ConnectionState.Closed Then Cn.Open()
                    .Parameters.AddWithValue("@BankAccountDetail", txtBankAccountDetail.Text.Trim)
                End With
            End Using
            txtBankAccountDetail.Text = ""
        End Sub

    but I have an error:

    Incorrect syntax near '@BankAccountDetail'.

    please help me


    Name of Allah, Most Gracious, Most Merciful and He created the human

    Friday, April 13, 2012 6:11 AM


  • Try by placing a closing bracket ")" next to @BankAccountDetail in the command

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by sh 2020 Friday, April 13, 2012 12:54 PM
    Friday, April 13, 2012 9:59 AM