Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Tags for this Thread

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Ricky
    Ricky's Avatar
    Guest

    How do i insert a new record on a particular ID number in MSSQL (ASP.NET)?

    I want only two records to be in my table (database), new record should overwrite the previous records on basis on ImgID .
    WHERE ImgID=1

    i am using this code:


    Dim conn As New SqlConnection
    conn.ConnectionString = ConfigurationManager.ConnectionStrings("DispImages ConnectionString").ConnectionString

    Dim cmd As New SqlCommand

    cmd.CommandText = "INSERT INTO ImgTable (PicURL) VALUES (@PicURL)"

    cmd.Parameters.Add("@PicURL", SqlDbType.VarChar)

    cmd.Parameters("@PicURL").Value = FileUpload1.FileName

    cmd.Connection = conn
    conn.Open()

    cmd.ExecuteNonQuery()
    conn.Close()
    Label1.ForeColor = Drawing.Color.Green
    Label1.Text = "<b>File Uploaded Successfully</b>" & "<br>" & "File name: " & _
    FileUpload1.FileName


    -----------------------
    I tried this code, but won't work...

    cmd.CommandText = "INSERT INTO ImgTable (PicURL) VALUES (@PicURL) WHERE ImgID=1"

  2. #2
    flipper3465
    flipper3465's Avatar
    Guest
    who cares micro nerd geat a life force
    p.s doodle

 

 

Quick Reply Quick Reply

Click here to log in


In what corner do we have Search box?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 01-13-2012, 05:23 AM
  2. Replies: 0
    Last Post: 04-08-2011, 06:58 PM
  3. How to insert a record in MS Access Database using asp?
    By vishal Alone in forum Discuss ASP
    Replies: 0
    Last Post: 01-12-2009, 06:23 AM
  4. Replies: 0
    Last Post: 12-03-2008, 11:33 AM
  5. Replies: 0
    Last Post: 12-03-2008, 11:33 AM

Bookmarks

Posting Permissions

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