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. problem with updating into database.

problem with updating into database.

Scheduled Pinned Locked Moved ASP.NET
databasedesignsysadminhelpannouncement
1 Posts 1 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.
  • F Offline
    F Offline
    frossie
    wrote on last edited by
    #1

    aspx.vb file Public Class Default1 Inherits System.Web.UI.Page Dim inc As Integer Dim txtEventDate As Date Dim txtEventTrigger As Date Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= " & Server.MapPath("~/App_Data/db1.mdb")) Public Sub LoadData() Dim da As New OleDbDataAdapter("SELECT * FROM checklist_Items", objConn) Dim ds As DataSet = New DataSet() da.Fill(ds, "checklist_Items") MyDataList.DataSource = ds.Tables("checklist_Items").DefaultView MyDataList.DataBind() End Sub Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then LoadData() End If End Sub Sub Update_dc(ByVal ID) '---updates the database--- Dim sql As String = "UPDATE checklist_Items SET date_Completed=#" + txtEventDate + "# WHERE ID=" + ID Dim comm As New OleDbCommand(sql, objConn) objConn.Open() comm.ExecuteNonQuery() objConn.Close() MyDataList.EditItemIndex = -1 LoadData() End Sub Sub Update_dt(ByVal ID) '---updates the database--- Dim sql As String = "UPDATE checklist_Items SET date_Trigger=#" + txtEventTrigger + "# WHERE ID=" + ID Dim comm As New OleDbCommand(sql, objConn) objConn.Open() comm.ExecuteNonQuery() objConn.Close() MyDataList.EditItemIndex = -1 LoadData() End Sub Sub MyDataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles MyDataList.UpdateCommand Dim tbox As TextBox Dim ID0 As String Dim sday As DateTime '---retrieves the key for the row--- ID0 = MyDataList.DataKeys(e.Item.ItemIndex) '---find the textbox control containing the dateCompleted tbox = CType(e.Item.FindControl("txtEventDate"), TextBox) txtEventDate = tbox.Text sday = txtEventDate If (ID0 = 5) Then Update_dc(ID0) MsgBox("eventdate " + txtEventDate) '---retrieves from another database--- Dim con = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

    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