Resources for IT Professionals > 포럼 홈 > TechNet Online: Future Plans > Syntax error in INSERT INTO statement
질문하기질문하기
 

질문Syntax error in INSERT INTO statement

  • 2009년 6월 9일 화요일 오전 1:32Nageh Omran 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    I have this code to save data in access database and i have this error
    Syntax error in INSERT INTO statement
    code

    Dim

    f1, f2, f3, f4, f5, f6, f7, f8, f9, f10 As String

     

    Dim f11, f12, f13, f14, f15, f16, f17, f18 As String

    f1 =

    "'" & TextBox1.Text & "',"

    f2 =

    "'" & DateTimePicker1.Value & "',"

    f3 =

    "'" & ComboBox1.Text & "',"

    f4 =

    "'" & TextBox2.Text & "',"

    f5 =

    "'" & TextBox3.Text & "',"

    f6 =

    "'" & TextBox4.Text & "',"

    f7 =

    "'" & TextBox5.Text & "',"

    f8 =

    "'" & TextBox6.Text & "',"

    f9 =

    "'" & TextBox8.Text & "',"

    f10 =

    "'" & ComboBox3.Text & "',"

    f11 =

    "'" & TextBox7.Text & "',"

    f12 =

    "'" & TextBox9.Text & "',"

    f13 =

    "'" & TextBox10.Text & "',"

    f14 =

    "'" & TextBox11.Text & "',"

    f15 =

    "'" & ComboBox4.Text & "',"

    f16 =

    "'" & DateTimePicker2.Value & "',"

    f17 =

    "'" & DateTimePicker3.Value & "',"

    f18 =

    "'" & ComboBox2.Text & "'"

    S =

    "INSERT INTO Cust "

    S = S &

    "(sName,Birth_Date,Gender,Nationality,Address,Tel,Mobile,Fax,ID_Num,ID_Type,"

    S = S &

    "E_mail,Account_Num,Maximum,Card_Name,Card_Type,First_Date,Last_Date,Work_Ttpe)"

    S = S & f1 & f2 & f3 & f4 & f5 & f6 & f7 & f8 & f9 & f10

    S = S & f11 & f12 & f13 & f14 & f15 & f16 & f17 & f18 &

    ")"

    Cmd.CommandText = S

    H = Cmd.ExecuteNonQuery

    MsgBox(H &

    "record Saved")
    i want to know where is the error in this code thanks for help