I have successfully Create a Site, Inserting Updating andDeleting information in my DB all with Stored Procedures, But I need theability to pass their username into my Stored Procedures. How and where do Icode this in my ASPX file?
My SP would be something like this
 
Create procedure test
@.UserNamevarchar(50)
As
Select *
From table
Where username= @.username
All of thedata is tied to the user in one way or another but I do not know what code toput in my page?
If you can get correct username in your application, why not use SqlCommand?
 using(SqlConnection conn= new SqlConnection(@."Data Source=.\iori2000;Integrated Security=SSPI;Database=master"))
            {
                SqlCommand cmd= new SqlCommand("test",conn);
                conn.Open();
                cmd.CommandType=CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@.username", username);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                sda.Fill(dt);
//add your code
}
|||
I do not know that I'm following.
Here is the Code I would like to put pull the username.
<%@. Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource1" Style='position: relative'>
        <Columns>
            <asp:BoundField DataField="Task_Name" HeaderText="Task_Name" SortExpression="Task_Name" />
            <asp:BoundField DataField="project_name" HeaderText="project_name" SortExpression="project_name" />
            <asp:BoundField DataField="priority_desc" HeaderText="priority_desc" SortExpression="priority_desc" />
            <asp:BoundField DataField="Assigned_to" HeaderText="Assigned_to" SortExpression="Assigned_to" />
            <asp:BoundField DataField="status" HeaderText="status" SortExpression="status" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WebAppConnectionString %>"
        SelectCommand="task_summary_info" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
</asp:Content>
 
 
No comments:
Post a Comment