Search blog.co.uk

Posts archive for: April, 2006
  • Crystal Reports & Parameters

    Dont create reports in crystal report by the wizard, infact do like as blank report and then after selecting data source select the add command, then in ur command insert ur query and any place where u are using a where clause , on the side u will see add paramter, so add a parameter and then where u are using the where clause like see
    select * from user where user_id={?id}
    this id was the new parameter added
    select top {?val} * from user
    here val is the parameter
    after creating the report in the programming, i mean in dotnet
    create a text box for the value of the parameter and then, on a button click event write the following code

    CrystalReport1 cr=new CrystalReport1();
    cr.SetParameterValue("id",int.Parse(textBox1.Text));
    crystalReportViewer1.ReportSource=cr;

    this can be accessed by the index number also like by 0, 1 , 2
    hope this will be useful

  • Encrypt/Decrypt Web.config Sections

    its not written by me but really useful for me
    One of the cool new features of ASP.NET 2.0 is the ability to encrypt any section of the Web.config. This is not directly supported by Visual Studio, however. You need to run aspnet_regiis.exe at a Visual Studio 2005 Command Prompt (look under Visual Studio Tools in your Visual Studio 2005 start menu group).
    To encrypt the connectionStrings section of an IIS virtual root based Web site named WebSite1, enter the following at the command prompt:aspnet_regiis -pe "connectionStrings" -app "/ WebSite1"
    To decrypt the same section, enter the following:aspnet_regiis -pd "connectionStrings" -app "/ WebSite1"

    You can also encrypt/decrypt sections of file-system based Web sites. For example, if the same WebSite1 site was not a virtual root and was located in the d:\WebSites folder, you would enter the following at the command prompt instead to encrypt the connectionStrings section:aspnet_regiis -pef "connectionStrings" "d:\WebSites\WebSite1"
    And to decrypt the same section of the same Web site:aspnet_regiis -pdf "connectionStrings" "d:\WebSites\WebSite1"

  • Personalization Database Configuration asp.net 2.0

    By default, web parts uses the SQL 2005 Express provider for data storage. To use SQL Server 2000, you need to do some work:
    do create a database in sql server with the name aspnetdb

    dont get confused when u see (( )) this is coz google gets mad when it sees &lt &gt

    1. Use the aspnet_regsql.exe tool located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\ to prepare SQL Server 2000.

    Essentially it will add the aspnetdb database.

    2. In Web.config, add the following:
    (connectionStrings)
    (add name="myconnstring" connectionString="Data Source=your_server_name;Initial Catalog=aspnetdb;Integrated Security=True"providerName="System.Data.SqlClient" /)(/connectionStrings)

    (system.web)......
    (webParts)
    (personalizationdefaultProvider="SqlPersonalizationProvider")
    (providers)
    (add name="SqlPersonalizationProvider"type="System
    .Web.UI.WebControls.WebParts
    .SqlPersonalizationProvider"connectionStringName=
    "myconnstring"applicationName="/" /)(/providers)
    (authorization)
    (deny users="*" verbs="enterSharedScope" /)
    (allow users="*" verbs="modifyState" /)
    (/authorization)
    (/personalization)
    (/webParts)
    (/system.web)

    That should work fine then.

  • Get Connectionstring from web.config

    constring = (string)ConfigurationManager..
    .ConnectionStrings["connstr"].ConnectionString;

    where
    connstr is the connectionstring name in web.config

Footer:

The content of this website belongs to a private person, blog.co.uk is not responsible for the content of this website.