Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to update,delete from asp.net?

how to update,delete from asp.net?

Scheduled Pinned Locked Moved Database
csharpasp-netoracletutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Oracle Friend
    wrote on last edited by
    #1

    any one remind me how to update,delete on asp.net based on given txtfield? e.g we write code like this in oracle: --update code: update EMP set f_name=:txt_name where id=:txt_id; commit; ---delete code: delete from EMP where id=:txt_id; commit; yesser yasser :rose:

    P R 2 Replies Last reply
    0
    • O Oracle Friend

      any one remind me how to update,delete on asp.net based on given txtfield? e.g we write code like this in oracle: --update code: update EMP set f_name=:txt_name where id=:txt_id; commit; ---delete code: delete from EMP where id=:txt_id; commit; yesser yasser :rose:

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Best way to do this is through parameterized queries. See this[^] article for advice. Obviously, you will want to use the Oracle .Net providers.

      Deja View - the feeling that you've seen this post before.

      1 Reply Last reply
      0
      • O Oracle Friend

        any one remind me how to update,delete on asp.net based on given txtfield? e.g we write code like this in oracle: --update code: update EMP set f_name=:txt_name where id=:txt_id; commit; ---delete code: delete from EMP where id=:txt_id; commit; yesser yasser :rose:

        R Offline
        R Offline
        rohitsrivastava
        wrote on last edited by
        #3

        imports system.data.sqlclient dim objsqlconn as sqlconnection dim objsqlcmd as sqlcommand dim dataset as dataset dim strupdate as string first update objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername") objsqlconn.open strupdate="update EMP set f_name=:txt_name where id=:txt_id" objsqlcmd=new sqlcommand(strupdate,objsqlconn) objsqlcmd.executenonquery() messagebox.show("Record successfully update") second delete objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername") objsqlconn.open strdelete="delete from EMP where id=:txt_id" objsqlcmd=new sqlcommand(strdelete,objsqlconn) objsqlcmd.executenonquery() messagebox.show("Record successfully delete")

        O P 2 Replies Last reply
        0
        • R rohitsrivastava

          imports system.data.sqlclient dim objsqlconn as sqlconnection dim objsqlcmd as sqlcommand dim dataset as dataset dim strupdate as string first update objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername") objsqlconn.open strupdate="update EMP set f_name=:txt_name where id=:txt_id" objsqlcmd=new sqlcommand(strupdate,objsqlconn) objsqlcmd.executenonquery() messagebox.show("Record successfully update") second delete objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername") objsqlconn.open strdelete="delete from EMP where id=:txt_id" objsqlcmd=new sqlcommand(strdelete,objsqlconn) objsqlcmd.executenonquery() messagebox.show("Record successfully delete")

          O Offline
          O Offline
          Oracle Friend
          wrote on last edited by
          #4

          :rose:Thanks rohitsrivastava this is very Advance code ,but at the moment am using access database .I want only the Syntax or the command to delete,update. I remmber in the past I was writing like this but am not soure about the Syntax updatecode="update EMP set f_name Val&"(first_name.txt)"&''&"where id=Val&"(txtid.txt)"&" -- modified at 8:07 Wednesday 12th September, 2007 yasser

          1 Reply Last reply
          0
          • R rohitsrivastava

            imports system.data.sqlclient dim objsqlconn as sqlconnection dim objsqlcmd as sqlcommand dim dataset as dataset dim strupdate as string first update objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername") objsqlconn.open strupdate="update EMP set f_name=:txt_name where id=:txt_id" objsqlcmd=new sqlcommand(strupdate,objsqlconn) objsqlcmd.executenonquery() messagebox.show("Record successfully update") second delete objsqlconn=new sqlconnection("user id=sa;password=;initial catalog=databasename;data source=servername") objsqlconn.open strdelete="delete from EMP where id=:txt_id" objsqlcmd=new sqlcommand(strdelete,objsqlconn) objsqlcmd.executenonquery() messagebox.show("Record successfully delete")

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            How do you think this will work? First of all, you are connecting to SQL Server here, secondly the strupdate command is wrong. Finally, always use parameterized queries as they are much better.

            Deja View - the feeling that you've seen this post before.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups