Thursday, May 24, 2012

TOO Many Arguments Specified Resolved

Heloo to all, Now guys i am going to tell you that how you can check your Sql datasource parameters.
when you pass parameters from .aspx page,mostly time you get an error

TOO MANY ARGUMENTS SPECIFIED

To check it you have to call updating method

protected void SqlDataSource2_Updating(object sender, SqlDataSourceCommandEventArgs e)
    {
     
        for (int i = 0; i < e.Command.Parameters.Count; i++)
        {
            Trace.Write(e.Command.Parameters[i].ParameterName);
            if (e.Command.Parameters[i].Value != null)
            {
                Trace.Write(e.Command.Parameters[i].Value.ToString());
            }
        }
    }


with this you can check each value by parameter wise

Monday, May 14, 2012

Retrieve only Time in sql

Hello to all Now i will tell you that how to fetch only time from GetDate() function

SELECT LTRIM(RIGHT(CONVERT(VARCHAR(20),  GetDate() , 100), 7))

Make checkbox checked,Unchecked according to status 0&1 at .aspx page

Hello to all Now I am going to tell you that How can You bind checkbox in datalist and make it Checked and unchecked in .aspx page itself. No Need to do code at .cs page


 <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource2">
                    <ItemTemplate>
                      
                                <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Eval("status").ToString() == "1" ? true : false %>' />
                           
                    </ItemTemplate>
                </asp:DataList>