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
  1. Home
  2. Web Development
  3. ASP.NET
  4. transaction in asp.net

transaction in asp.net

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netdatabase
2 Posts 2 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.
  • T Offline
    T Offline
    TechnoGrey
    wrote on last edited by
    #1

    i have code like this : Dim SQL As String SQL = String.Format("delete from CEVAPLAR where PERSONEL_ID={0} and BOLUM_ID={1} and DONEM='{2}'", ddlPersonel.SelectedItem.Value, ddlBolumAdi.SelectedItem.Value, Session("donem")) Dim cmd As New SqlCommand(SQL, cn) cmd.Connection.Open() Dim sql1 As String sql1 = String.Format("delete from NOTLAR where PERSONEL_ID={0} and BOLUM_ID={1} and DONEM='{2}'", ddlPersonel.SelectedItem.Value, ddlBolumAdi.SelectedItem.Value, Session("donem")) Dim cmd1 As New SqlCommand(sql1, cn) cmd1.Connection.Open() there is two sql command here. I want to run this querries in a transaction.if one of them this querries are cancelled both of them are made rollback. How can i coded this transaction in asp.net vb codebehind.? Thanks..

    T 1 Reply Last reply
    0
    • T TechnoGrey

      i have code like this : Dim SQL As String SQL = String.Format("delete from CEVAPLAR where PERSONEL_ID={0} and BOLUM_ID={1} and DONEM='{2}'", ddlPersonel.SelectedItem.Value, ddlBolumAdi.SelectedItem.Value, Session("donem")) Dim cmd As New SqlCommand(SQL, cn) cmd.Connection.Open() Dim sql1 As String sql1 = String.Format("delete from NOTLAR where PERSONEL_ID={0} and BOLUM_ID={1} and DONEM='{2}'", ddlPersonel.SelectedItem.Value, ddlBolumAdi.SelectedItem.Value, Session("donem")) Dim cmd1 As New SqlCommand(sql1, cn) cmd1.Connection.Open() there is two sql command here. I want to run this querries in a transaction.if one of them this querries are cancelled both of them are made rollback. How can i coded this transaction in asp.net vb codebehind.? Thanks..

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      Something like this. Used stored procs though!!!! Dim SQL As String SQL = String.Format("delete from CEVAPLAR where PERSONEL_ID={0} and BOLUM_ID={1} and DONEM='{2}'", ddlPersonel.SelectedItem.Value, ddlBolumAdi.SelectedItem.Value, Session("donem")) Dim cn As New SqlConnection Dim cmd As New SqlCommand(SQL, cn) Dim trans As SqlTransaction cmd.Connection.Open() trans = cn.BeginTransaction Dim sql1 As String sql1 = String.Format("delete from NOTLAR where PERSONEL_ID={0} and BOLUM_ID={1} and DONEM='{2}'", ddlPersonel.SelectedItem.Value, ddlBolumAdi.SelectedItem.Value, Session("donem")) Dim cmd1 As New SqlCommand(sql1, cn) trans.Commit() how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06

      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