Saturday, December 26, 2009

How to avoid “The report you requested requires further information” when you try to connect Crystal report using ASP.NET


Some times when you run a Crystal report using ASP.NET you will get the error

“The report you requested requires further information”.

I got this error when I tried to connect AS/400 using iSeries ODBC Drivers

See figure 1.











Figure 1 the error message

You get this error because your DSN is not able to pass log in info to your crystal report.

There is 2 ways to solve this problem


1:- Save user and password information in your DSN.

This solution is good when the DSN allow you to save User and Password

For example DSN that connected to Sql Server .

See Figure 2

















Figure 2

2:Pass User and Password information to crystal report
Pass User and Password info by using report document to your report.

You can pass log in info by using SetDatabaseLogon(User,Password) property.

Also you should verify database by using VerifyDatabase() method to pass log in info.


Example:

In this example my Crystal report get customer number as parameter and display customer info.

The report name is "cusrep.rpt"

The ASP.NET page get customer number as parameter “cusnum”.

The parameter name in crystal report is “CUNO”.

The report viewer control name is “myCrystalReportViewer”.

At page load event the program get the parameter and display te report,

P.S : do not forget to import crystal classes.


Imports CrystalDecisions.CrystalReports.Engine

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim MyRep, Myfile As String

MyRep = "cusrep.rpt"
customerReport = New ReportDocument()


'******** Load the report

Dim reportPath As String = Server.MapPath(MyRep)

customerReport.Load(reportPath)

'******** Pass log in info

customerReport.SetDatabaseLogon("Db user", "Db Password")

'******** Verify Data base

customerReport.VerifyDatabase()

'********* Pass parameter and display report

myCrystalReportViewer.ReportSource = customerReport

myCrystalReportViewer.ParameterFieldInfo.Clear()

Dim ParamFields As ParameterFields = myCrystalReportViewer.ParameterFieldInfo

Dim Rep01 As New ParameterField

Dim CusNum As String

CusNum = Request("cusnum")

Rep01.Name = "CUNO" '

Dim Rep01_Value As New ParameterDiscreteValue

Rep01_Value.Value = CusNum

Rep01.CurrentValues.Add(Rep01_Value)

ParamFields.Add(Rep01)

For Each cnInfo As TableLogOnInfo In Me.myCrystalReportViewer.LogOnInfo

cnInfo.ConnectionInfo = ConnInfo

Next

myCrystalReportViewer.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX

End Sub



Monday, December 21, 2009

ODBC Connection String FAQ

Everything you always wanted to know about ODBC connection strings and the iSeries.
When using ODBC to talk to the AS/400, you can use a data source name to connect or you can use a connection string with all of the relevant settings in the string you pass to the ODBC Driver. A data source name stores ODBC information in the Windows registry after you use the ODBC Data Source Administrator to configure your data source. The problem with data source names is that each time you attempt to connect; the program has to look up information about the connection options in the Windows registry. If you are programming a web application, you could be issuing hundreds of connections to the iSeries a minute, and the performance hit of reading the registry is not something you want to have in your application. Another problem with data source names, if you are deploying ODBC applications to end users, is that you must set up the data source on the end users machine as part of your program installation process. This can be problematic, and if the desktop is not properly configured you end users can futz with their ODBC settings and possibly make changes the break the application. All of the above can be avoided by using a connection string rather than using an ODBC data source name when connecting. In addition, you will have finite control over how you application interacts with the iSeries.

Read this article Read this article Read this article Read this article

Friday, September 25, 2009

Get image height and width without creating bitmap

By HAFIZ Kashkoush

Usually to resize an image we upload the image ,create bitmap ,resize it
and save the new resized image.
I can use this technique in case that I need a new resized image file otherwise
this technique become very complicated .

In this article I going to
1:-Upload an image to Image control (image1)
2:-Get image info (width and height)
3:-When user click resize button the image will be resized for 50%
of it original size.

First i add to my form 2 controls
A:-Image control -Image ID="Image1"
B:-Button control to resize image - Button ID="BResize"

2:- In my code I declare 3 global variables
Dim ImageWidth As Integer 'Image width
Dim ImageHeight As Integer 'Image height
Dim imageurl As String 'Image URL

3:- In my page load event I load the image to image1 control and get image info.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
'************************************************************************
'******* This string contain image URL
'******* My image name is "1_o.jpg" and it located in my application
'******* directory in this case the image URL="1_o.jpg"

'************************************************************************
imageurl = Server.MapPath("1_o.jpg")
'******** Load the image into image1 control
Image1.ImageUrl = imageurl
'******** Get Image Info
Dim fullSizeImg As System.Drawing.Image = System.Drawing.Image.FromFile(imageurl)
'******** Image Width
ImageWidth = fullSizeImg.Width
'******** Image Height
ImageHeight = fullSizeImg.Height
End Sub

4:-In the button resize click event I resize the image to 50% of it original size
by changing image1 width an height values.
Protected Sub BResize_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Image1.Height = Int(ImageHeight / 2)
Image1.Width = Int(ImageWidth / 2)
End Sub

Thursday, September 17, 2009

Very Compatible DHTML Menu ASP.NET User Control

Introduction
A DHTML menu is something many web developers use these days as those provide a friendly and hierarchical interface for users. In a project I�m working on, I need one of those, and I searched the web to find an ASP.NET control. There are some good examples of menu controls but none of them gives what really I want (cross-browser, VB.NET, code available, free, and with possibilities for nice styles). Then I found Sylvain Machefert�s work (in French). He is a web developer with good CSS, JavaScript and cross browser issues knowledge, who made a very compatible DHTML menu and released it to public. The menu even works on text based browsers, reading technologies for visually impaired considered, and the menu is not visible when printing your page. Also, it can be customized in many ways and it supports icon images.

Read this article

Thursday, September 3, 2009

AJAX - Databinding to an Accordion

The Accordion control in the AJAX Control Toolkit provides multiple panes and allows the user to display one of them at a time. Panels are usually declared within the page itself, but binding to a data source offers more flexibility.

Read this article

Wednesday, August 12, 2009

Passing value from popup window to parent form's TextBox

Passing values from a popup window back to the parent page is an often asked question. Especially when there is a GridView type control in the popup. In the following example we will be using two forms. The parent form will be parent.aspx and the popup will be popup.aspx. Also note that the parent.aspx form is derived from some MasterPage. Code is provided both in VB.Net and C#.Net.

Read this article

Friday, May 22, 2009

ASP.NET Security

This is a series of tutorials about ASP.NET Security, which explores techniques for authenticating visitors through a web form, authorizing access to particular pages and functionality, and managing user accounts in an ASP.NET application.

Thursday, May 21, 2009

Role Based Forms Authentication in ASP.NET

Abstract Using Role based forms authentication, we can restrict users of the site to accessing certain resource if they are not part of a particular role. In this article, Satheesh demonstrates how to build sites with this type of authentication. He provides a short overview of various Login Controls and Providers and then discusses a scenario with detailed explanation of various aspects of the sample application with screenshots and source code.


Read this article

Friday, May 1, 2009

Walkthrough: Displaying Hierarchical Data in a TreeView Control

The ASP.NET TreeView control is designed to present users with data in a hierarchical structure. Users can open individual nodes that can in turn contain child nodes. The TreeView control is suitable for displaying XML data, but can be used for any data that can be represented in a hierarchy. This walkthrough shows you the basics of using the TreeView control and various ways to display hierarchical data.
Tasks illustrated in this walkthrough include:



  • Using the TreeView control to display XML data.

  • Customizing the display of the TreeView control.

  • Displaying records from related database tables in the TreeView control.

Read this article

Tuesday, April 14, 2009

ASP.NET Hosting Options

Web applications are typically designed, created, and tested in a development environment that is accessible only to the programmers working on the site. Once the application is ready to be released, it is moved to a production environment where the site can be accessed by anyone on the Internet. This deployment process introduces a number of challenges:



  • A production environment must exist and be properly setup before an ASP.NET application can be deployed; moreover, the production environment must be kept up to date with the latest security patches.

  • The correct set of markup files, code files, and support files must be copied from the development environment to the production environment. For data-driven applications, this might require copying the database schema and/or data, as well.

  • There may be configuration differences between the two environments. The database connection string or e-mail server used in the development environment will likely be different than the production environment. What's more, the behavior of the application may depend on the environment. For example, when an error occurs in development the error's details can be displayed on screen, but when an error occurs in production, a user-friendly error page should be displayed instead, and the error details e-mailed to the developers.

Read this article

Security Basics and ASP.NET Support

This is the first tutorial in a series of tutorials that will explore techniques for authenticating visitors through a web form, authorizing access to particular pages and functionality, and managing user accounts in an ASP.NET application.
Introduction
What is the one thing forums, eCommerce sites, online email websites, portal websites, and social network sites all have in common? They all offer user accounts. Sites that offer user accounts must provide a number of services. At a minimum, new visitors need to be able to create an account and returning visitors must be able to log in. Such web applications can make decisions based on the logged in user: some pages or actions might be restricted to only logged in users, or to a certain subset of users; other pages might show information specific to the logged in user, or might show more or less information, depending on what user is viewing the page.
This is the first tutorial in a series of tutorials that will explore techniques for authenticating visitors through a web form, authorizing access to particular pages and functionality, and managing user accounts in an ASP.NET application. Over the course of these tutorials we will examine how to:



  • Identify and log users in to a website

  • Use ASP.NET’s Membership framework to manage user accounts
    Create, update, and delete user accounts

  • Limit access to a web page, directory, or specific functionality based on the logged in user

  • Use ASP.NET’s Roles framework to associate user accounts with roles

  • Manage user roles

  • Limit access to a web page, directory, or specific functionality based on the logged in user’s role - Customize and extend ASP.NET’s security Web controls

Read this article

Tuesday, March 31, 2009

CSS Tutorial

In our CSS tutorial you will learn how to use CSS to control the style and layout of multiple Web pages all at once. What is CSS?

  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements
  • Styles are normally stored in Style Sheets
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save you a lot of work
  • External Style Sheets are stored in CSS files
  • Multiple style definitions will cascade into one

Read this article

ASP ServerVariables Collection

The ServerVariables collection is used to retrieve the server variable values.
Syntax
Request.ServerVariables (server_variable)


Read this article

Thursday, March 26, 2009

Printing web page in ASP.NET

Very common tasks, needed in almost any kind of application are reporting and printing. Before or later you will need to provide a print option to your users. In Windows Forms applications print issues are better defined, but when using ASP.NET, printing of web form is not that easy.


There is a few questions, first, do you want printing on server side or on client side. If you want to print on server side, then you can use System.Drawing.Printing classes just like when you work with .Net Windows Forms application. But, if you try to enable printing facility on client side, you need to consider more constraints and different possible solutions, depending of your specific needs



Read this article

Thursday, March 19, 2009

Pinging IP address using ASP.NET 2.0 and VB .NET

This article will show you how to ping a hostname/ip using the .NET System.Net class, ASP.NET 2.0 and VB.NET
The .NET Framework offers a number of types that makes accessing resources on the network easy to use.



Read this article

Monday, March 16, 2009

XML Programming with VB.NET

Extensible Markup Language (XML) is a meta-markup language that provides a format for describing structured data. XML is the universal language for data exchange on the Web. XML gives developers the power to deliver structured data from a wide variety of applications to the desktop for local computation and presentation.


Read this article

ASP.NET Charting Using Office Web Components (OWC)

The OWC Programming Model
In order to display an OWC chart from an ASP.NET Web page, we will create a single ASP.NET Web page whose sole duty is to display a chart. This Web page will be named getchart.aspx. In order to display this chart in a Web page, we'll use the standard HTML tag as follows:

Read this article

Monday, March 9, 2009

Reduce the size of the transaction logs of a SQL Server

How to stop the transaction log of a SQL Server database from growing unexpectedly.
This article describes the steps that you must follow when the transaction logs expand to an unacceptable limit. The expansion of the transaction logs can make your Microsoft SQL Server database unusable. This article also provides the options that you can use to stop the transaction logs from growing unexpectedly


Read this article


Keywords : Shrink ,Backup ,Compress ,Truncate , transactions , log ,Reduce the size of the transaction logs

Sunday, March 8, 2009

Using DataReaders, SQL Server

In this section we will work with databases in code. We will work with ADO .NET objects in code to create connections and read data using the data reader. We will see how to connect using our own connection objects, how to use the command object and so on. The namespace that needs to be imported when working with SQL Connections is System.Data.SqlClient. This section works with common database operations like insert, select, update and delete commands.


Read this article

Thursday, February 26, 2009

Displaying , Exporting and Printing Crystal Reports in ASP.NET

The main purpose of this document is to display the report without any error. I was bugged by the "Logon Failed Error" for several days, and now I finally have a code that displays report without any error. The code also Exports the report into .pdf, .xls, .rtf and .doc formats. It also prints the report directly to the printer.


Read this article

Different methods of loading Crystal Report in Crystal Report Viewer

This article explains different methods of loading Crystal Report in the Windows Forms from VB.NET.




Read this article

Working with Parameters with Crystal Reports and ASP.NET 2.0

This is the article in a series that covers programming with Crystal Reports with ASP.NET 2.0. In this article, we will focus on working with parameters using Crystal Reports and passing the parameter values from an ASP.NET 2.0 web site.


Read this article

Wednesday, February 18, 2009

Crystal Reports in ASP.NET

How to add crystal report to an ASP.NET page
Crystal Reports is the standard reporting tool for Visual Studio .NET used to display data of presentation quality. You can display multiple-level totals, charts to analyze data, and much more in Crystal Reports. Creating a Crystal Report requires minimal coding since it is created in Designer interface. It is available as an integrated feature of Microsoft Visual Studio .NET, Borland Delphi, and C#Builder.


Read this article

Tuesday, February 17, 2009

Dynamically Create Controls in ASP.NET with Visual Basic .NET

HOW TO: Dynamically Create Controls in ASP.NET with Visual Basic .NET
This step-by-step article describes how to dynamically create controls for an ASPX Web page.

Read this article

Saturday, February 14, 2009

How to call SQL Server stored procedures in ASP.NET by using Visual Basic .NET

This article demonstrates how to use ASP.NET and ADO.NET with Visual Basic .NET to create and to call a Microsoft SQL Server stored procedure with an input parameter and an output parameter.


Read this article