Results 1 to 2 of 2

Thread: [2005] Whats Wrong with this code??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Posts
    31

    [2005] Whats Wrong with this code??

    when i excute these line of code if gives me an error message (Unclosed quotation mark after the character string ''.)????????????

    Code:
    Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
            Dim SQL As String = "insert into Procedures(ProcedureName) Values('" & txtProcedureName.Text & "' )'"
            Dim cmdq As New SqlClient.SqlCommand
            cmdq.Connection = conn
            cmdq.CommandType = CommandType.Text
            cmdq.CommandText = SQL
            conn.Open()
            cmdq.ExecuteNonQuery()
            conn.Close()
            MsgBox("تمت العملية بنجاح")
    
        End Sub

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Whats Wrong with this code??

    Change this:
    vb.net Code:
    1. Dim SQL As String = "insert into Procedures(ProcedureName) Values('" & txtProcedureName.Text & "' )'"
    to this:
    vb.net Code:
    1. Dim SQL As String = "insert into Procedures(ProcedureName) Values('" & txtProcedureName.Text & "' )'"
    2. MessageBox.Show(SQL)
    and you should be able to see for yourself.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width