Click here to Skip to main content
15,911,646 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRe: How to map a network drive on client's computer using ASP.NET with C#? Pin
chhabrni16-Aug-06 4:56
chhabrni16-Aug-06 4:56 
QuestionProblem with CallBack in MasterPage Pin
offengenden14-Aug-06 22:20
offengenden14-Aug-06 22:20 
AnswerRe: Problem with CallBack in MasterPage Pin
minhpc_bk15-Aug-06 15:26
minhpc_bk15-Aug-06 15:26 
QuestionAccessing Child Control from a user control bY Java Script Pin
meetbinu200314-Aug-06 21:18
meetbinu200314-Aug-06 21:18 
AnswerRe: Accessing Child Control from a user control bY Java Script Pin
Paddy Boyd14-Aug-06 23:26
Paddy Boyd14-Aug-06 23:26 
GeneralRe: Accessing Child Control from a user control bY Java Script Pin
meetbinu200315-Aug-06 2:50
meetbinu200315-Aug-06 2:50 
GeneralRe: Accessing Child Control from a user control bY Java Script Pin
eggsovereasy15-Aug-06 3:28
eggsovereasy15-Aug-06 3:28 
Questionproblem with updating into database. Pin
frossie14-Aug-06 20:58
frossie14-Aug-06 20:58 
aspx.vb file
Public Class Default1<br />
        Inherits System.Web.UI.Page<br />
<br />
        Dim inc As Integer<br />
        Dim txtEventDate As Date<br />
        Dim txtEventTrigger As Date<br />
<br />
        Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
           "Data Source= " & Server.MapPath("~/App_Data/db1.mdb"))<br />
<br />
        Public Sub LoadData()<br />
            Dim da As New OleDbDataAdapter("SELECT * FROM checklist_Items", objConn)<br />
            Dim ds As DataSet = New DataSet()<br />
            da.Fill(ds, "checklist_Items")<br />
<br />
            MyDataList.DataSource = ds.Tables("checklist_Items").DefaultView<br />
            MyDataList.DataBind()<br />
<br />
        End Sub<br />
        Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
            If Not IsPostBack Then<br />
                LoadData()<br />
            End If<br />
<br />
        End Sub<br />
        Sub Update_dc(ByVal ID)<br />
<br />
            '---updates the database---<br />
            Dim sql As String = "UPDATE checklist_Items SET date_Completed=#" + txtEventDate + "# WHERE ID=" + ID<br />
            Dim comm As New OleDbCommand(sql, objConn)<br />
<br />
            objConn.Open()<br />
            comm.ExecuteNonQuery()<br />
            objConn.Close()<br />
<br />
            MyDataList.EditItemIndex = -1<br />
            LoadData()<br />
<br />
        End Sub<br />
<br />
        Sub Update_dt(ByVal ID)<br />
<br />
            '---updates the database---<br />
            Dim sql As String = "UPDATE checklist_Items SET date_Trigger=#" + txtEventTrigger + "# WHERE ID=" + ID<br />
            Dim comm As New OleDbCommand(sql, objConn)<br />
<br />
            objConn.Open()<br />
            comm.ExecuteNonQuery()<br />
            objConn.Close()<br />
<br />
            MyDataList.EditItemIndex = -1<br />
            LoadData()<br />
<br />
        End Sub<br />
Sub MyDataList_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles MyDataList.UpdateCommand<br />
            Dim tbox As TextBox<br />
            Dim ID0 As String<br />
            Dim sday As DateTime<br />
            <br />
            '---retrieves the key for the row---<br />
            ID0 = MyDataList.DataKeys(e.Item.ItemIndex)<br />
<br />
            '---find the textbox control containing the dateCompleted<br />
            tbox = CType(e.Item.FindControl("txtEventDate"), TextBox)<br />
            txtEventDate = tbox.Text<br />
            sday = txtEventDate<br />
If (ID0 = 5) Then<br />
                Update_dc(ID0)<br />
                MsgBox("eventdate " + txtEventDate)<br />
                '---retrieves from another database---<br />
                Dim con = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
               "Data Source= " & Server.MapPath("~/App_Data/vcalendar.mdb")<br />
                Dim da As OleDbDataAdapter<br />
                Dim dc As New DataSet<br />
<br />
                'Dim con As New OleDb.OleDbConnection<br />
                Dim cn As OleDbConnection = New OleDbConnection(con)<br />
                cn.Open()<br />
                Dim c As String = "SELECT * FROM events"<br />
<br />
                da = New OleDb.OleDbDataAdapter(c, cn)<br />
                da.Fill(dc, "events")<br />
                cn.Close()<br />
<br />
                '---find the textbox control containing the dateTrigger<br />
                Dim tbox1 = CType(e.Item.FindControl("txtEventTrigger"), TextBox)<br />
                txtEventTrigger = tbox1.text<br />
                tbox1.Text = dc.Tables("events").Rows(inc).Item(26)<br />
<br />
                Dim objdate As DateTime = New DateTime(Year(tbox1.Text), Month(tbox1.Text), Day(tbox1.Text))<br />
                Dim sday1 As DateTime = objdate<br />
                sday1 = sday1.AddDays(5)<br />
                txtEventTrigger = sday1<br />
<br />
                Update_dt(ID0)<br />
<br />
<br />
            End If<br />
<br />
        End Sub


i'm trying to update into database A this row and cell(date_Completed) with the value i typed into the textbox but at the same time, when i clicked on update, it should update the above statement as well as retrieve from another database B's table value and add 5 days. Upon addition, it should update the calculated value into the database A's same row and cell(date_Trigger).
But i'm facing this problem now that when i click on update, it will update the retrieved date from database B into database A's cell(date_Completed) and update the calculated value into database A's cell(date_Trigger). It kind of overwrites the value i typed in the textbox that was supposed to be updated and stay in the database A's cell(date_Completed).

I hope someone out there is able to understand my codes and provide me further help into this. Btw, if you think you needed more details into the .aspx file, please let me know. Thanks.


frossie

Questionneed help with wat this code do Pin
neodeaths14-Aug-06 19:46
neodeaths14-Aug-06 19:46 
AnswerRe: need help with wat this code do Pin
Guffa14-Aug-06 23:11
Guffa14-Aug-06 23:11 
GeneralRe: need help with wat this code do Pin
neodeaths15-Aug-06 5:23
neodeaths15-Aug-06 5:23 
Questionprinting on existing forms Pin
simple one14-Aug-06 17:56
simple one14-Aug-06 17:56 
AnswerRe: printing on existing forms Pin
RayLouw14-Aug-06 23:43
RayLouw14-Aug-06 23:43 
QuestionRetrieve ASP source code Pin
AshokGovindan14-Aug-06 14:46
AshokGovindan14-Aug-06 14:46 
AnswerRe: Retrieve ASP source code Pin
minhpc_bk14-Aug-06 15:23
minhpc_bk14-Aug-06 15:23 
QuestionMenu`s "target" property Pin
-Yoyosh-14-Aug-06 14:33
-Yoyosh-14-Aug-06 14:33 
AnswerRe: Menu`s "target" property Pin
minhpc_bk14-Aug-06 15:28
minhpc_bk14-Aug-06 15:28 
QuestionASP.net2.0 and FolderBrowserDialog, Pin
leylag14-Aug-06 11:49
leylag14-Aug-06 11:49 
AnswerRe: ASP.net2.0 and FolderBrowserDialog, Pin
Mike Ellison14-Aug-06 13:04
Mike Ellison14-Aug-06 13:04 
QuestionLike HTML File Control Pin
chinna8214-Aug-06 11:38
chinna8214-Aug-06 11:38 
AnswerRe: Like HTML File Control Pin
minhpc_bk14-Aug-06 15:31
minhpc_bk14-Aug-06 15:31 
Questionloading .... message same webpage Pin
prettyjcfreak14-Aug-06 10:31
prettyjcfreak14-Aug-06 10:31 
AnswerRe: loading .... message same webpage Pin
minhpc_bk14-Aug-06 15:39
minhpc_bk14-Aug-06 15:39 
Questionloading .... message same webpage Pin
prettyjcfreak14-Aug-06 10:31
prettyjcfreak14-Aug-06 10:31 
AnswerRe: loading .... message same webpage Pin
minhpc_bk14-Aug-06 15:40
minhpc_bk14-Aug-06 15:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.