Sunday, May 9, 2010

INSERT VALUES in SQL, ASP(VB)

8 comments:

  1. What is the format of date,, because i insert any date it shows 1-jan-00,like i wrote 25-mar-2008,, it shows 1-jan-00.

    ReplyDelete
  2. Emmu ,,error at this line
    cmd.ExecuteNonQuery()
    i show u whole program

    con = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\khan\khan's work\Visual studio\Vote Casting\CastVote\CastVote\App_Data\Database1.mdf;Integrated Security=True;User Instance=True")
    con.Open()
    cmd = New SqlCommand("insert into voter values(" + TextBox1.Text + ",'" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "')", con)
    cmd.ExecuteNonQuery()
    Label1.Text = ("Record inserted")
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox4.Text = ""
    TextBox5.Text = ""
    TextBox6.Text = ""
    con.Close()

    ReplyDelete
  3. Emmu,, Its a mistake i mean error because of date. how to handel it

    ReplyDelete
  4. my id is set to primary and auto increment. when I enter an id it says i can't, when i don't it says it can't be a string
    how do you handle id fields

    ReplyDelete
  5. please tell me how can i create a database table on single button click event

    ReplyDelete
  6. please tell me how can i create a simple forum.

    ReplyDelete
  7. I am having the same error ---
    cmd.ExecuteNonQuery()

    It says Incorrect syntax error'('. 'Delivery' is not recognized SET option.

    Please help...

    ReplyDelete