User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS Access and FileMaker Pro section within the Web Development category of DaniWeb, a massive community of 396,892 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,227 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS Access and FileMaker Pro advertiser:
Views: 4265 | Replies: 2
Join Date: Nov 2004
Posts: 13
Reputation: dru987 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
dru987 dru987 is offline Offline
Newbie Poster

Help access UPDATE problems

  #1  
May 13th, 2005
i have a very simple access DB and im tryin to update the records but the update never works. im using asp.net/vb.net and i've include the execute in a try/catch block and it always prints the sql string (the catch). here is my code, perhaps i have an error that ive missed:

SQL = "UPDATE members " & _
         "SET username = '" & txtUsername.Text.Trim() & "', " & _
         "password = '" & txtPassword1.Text.Trim() & "', " & _
         "first_name = '" & txtFirstName.Text.Trim() & "', " & _ 
         "last_name = '" & txtLastName.Text.Trim() & "', " & _
         "email = '" & txtEmail.Text.Trim() & "'" & _
         "WHERE first_name = " & Session("first_name") & _
         "AND last_name = " & Session("last_name") & ""

' Check if connection to DB is already open
If MyConn.State = ConnectionState.Closed Then
    MyConn.Open()
End If

Dim MyCmd As New OleDbCommand(SQL, MyConn)

' Try/Catch...in case DB error
Try
    MyCmd.ExecuteNonQuery()
    MyConn.Close()
    MyConn.Equals("")

    Response.Redirect("default.aspx")

Catch ex As Exception
    profile_error.Text = SQL 
    profile_error.Style("Color") = "red"
End Try

im also adding a user ID soon and will be changing the where to check for the unique ID.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS Access and FileMaker Pro Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS Access and FileMaker Pro Forum

All times are GMT -4. The time now is 4:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC