Basically I am just trying to figure out how I can display customer records for the user who is logged in. I am sure this is very simple just not 100% sure how. I have a form that the user submits new customers and it stores the userid for the user who is logged in so I can reference when we want to display the records they are responsible for. This has been an easy task for me using asp classic and I just need the right way to do it using .NET.
Something like
SELECT *
FROM customers
WHERE userid = @userid
ORDER BY submit_date
I have an insert form view that inserts data including the userID of the logged in user.Using this VB code in my code behind page;
Protected Sub jras_intranet_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles jras_intranet.Inserting
e.Command.Parameters("@userid").Value = Membership.GetUser.ProviderUserKey
End Sub
Here is the datasource code I am using that I need to verify with a WHERE statement userid = userid somehow;
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataCustomerEntries"
TypeName="customer_entryTableAdapters.customer_entryTableAdapter"
UpdateMethod="Update">
<SelectParameters>
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="Original_cus_id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="first_name" Type="String" />
<asp:Parameter Name="last_name" Type="String" />
<asp:Parameter Name="cell_phone" Type="String" />
<asp:Parameter Name="other_phone" Type="String" />
<asp:Parameter Name="status" Type="String" />
<asp:Parameter Name="paid" Type="String" />
<asp:Parameter Name="date_submited" Type="DateTime" />
<asp:Parameter Name="notes" Type="String" />
<asp:Parameter Name="email" Type="String" />
<asp:Parameter Name="location" Type="String" />
<asp:Parameter Name="appointment_date" Type="String" />
<asp:Parameter Name="Original_cus_id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="first_name" Type="String" />
<asp:Parameter Name="last_name" Type="String" />
<asp:Parameter Name="cell_phone" Type="String" />
<asp:Parameter Name="other_phone" Type="String" />
<asp:Parameter Name="status" Type="String" />
<asp:Parameter Name="paid" Type="String" />
<asp:Parameter Name="date_submited" Type="DateTime" />
<asp:Parameter Name="notes" Type="String" />
<asp:Parameter Name="email" Type="String" />
<asp:Parameter Name="location" Type="String" />
<asp:Parameter Name="appointment_date" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
Your help is greatly appreciated!
Best regards,
Shawn