Member_2_5230414
asked on
Insert/Update
With the code below what would be the best way to check to see if "Username" is allready in the database... if it is updateit if not insert it?
Public Shared Sub trackusers(ByVal thepage As String)
Using con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\perkinj\My Documents\Visual Studio 2010\WebSites\runningprofiles\forums\forum.mdb")
Dim Username As String = Membership.GetUser.UserName.ToString
Using cmd As New OleDbCommand("INSERT into nousersonline (Username,Activity,PageUrl,ActivityDate) VALUES ('" & Username & "','', '" & thepage & "','" & DateAndTime.Now.ToString & "')", con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using
End Using
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.