Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Thursday, March 8, 2012

Data Binding-DataAdapter

Hi i'm a new to ASP.NET and for some reason when i click the Next button in the code below, the pageIndex does not change. Please assist, Basically what i'm trying to do is to use DataAdapter.fill but passing in the start index and the number of records to pull from the dataset table.

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.OleDb;

publicpartialclassHome : System.Web.UI.Page

{

//Connection

OleDbConnection dbConn;

//discount that can be change by user using a gui interface

//CurrentPage

int pageIndex = 0;double discount = 0.15 ;

protectedvoid Page_Load(object sender,EventArgs e)

{

// homeGridView.Visible = true;

BindList();

}

protectedstring getSpecial(string price,object sale)

{

String special ="";if (sale.ToString().CompareTo("True") == 0)

{

special =String.Format("{0:C}",double.Parse(price) * (1-discount));

}

return special;

}

protectedvoid BindList()

{

//Creating an object for the 'PagedDataSource' for holding the data.

//PagedDataSource objPage = new PagedDataSource();

try

{

//open connection

openConnection();

//sql command

string columns ="*";

string SqlCommand ="Select " + columns +" from Books";

//create adapters and DataSet

OleDbDataAdapter myAdapter =newOleDbDataAdapter(SqlCommand, dbConn);DataSet ds =newDataSet("bSet");

//create table

DataTable dt =newDataTable("Books");myAdapter.Fill(ds, pageIndex, 9,"Books");

Response.Write("Page Index: "+pageIndex);

//create table data view

DataView dv =newDataView(ds.Tables["bTable"]);

booksDataList.DataSource = ds;

booksDataList.DataBind();

myAdapter.Dispose();

dbConn.Close();

}

catch (Exception ex)

{

Response.Write("Exception thrown in BindList()");

dbConn.Close();

throw ex;

}

}

publicvoid openConnection()

{

string provider="Microsoft.Jet.OLEDB.4.0";

string dataSource ="C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/WebSites/E-BookOnline/App_Data/BooksDB.mdb";

dbConn =newOleDbConnection("Provider =" + provider +";" +"Data Source =" + dataSource);

dbConn.Open();

}

protectedvoid nextClick(object sender,EventArgs e)

{

pageIndex=pageIndex+1;

Response.Write("In nextClick"+pageIndex);

BindList();

}

protectedvoid prevClick(object sender,EventArgs e)

{

if (pageIndex > 0)

{

pageIndex=pageIndex-1;

BindList();

}

}

}

It is not advisable to use DataAdpater to page records... instead of this you need to use queries for that but anyway you can found this article useful.

http://msdn2.microsoft.com/en-us/library/tx1c9c2f(VS.80).aspx

Satya

Friday, February 24, 2012

DAO Error code 0xbd7

Hi
I have a button in vb calling crsytal reports 9 . These reports are opening in cr viewer. I have an access database secured with a password. I can open the report but when I go to enter new parameters in the cr viewer, I get this error.

"LOGON FAILED"
Details: DAO Error Code 0xbd7
Source: Dao.Workspace
Description: Not a valid Password

Im lost on this one and I would be grateful for some help.
Thanks!!Hello,
This is in C#, I thing it can help you :

crystalReportDocument1.DataSourceConnections[0].SetConnection(SERVER, Database, "USERNAME", "YOUR PASSWORD"); crystalReportViewer1.ReportSource = crystalReportDocument1;

I use Microsoft Access file, so I left the Username blank, and for Server and Database put the new path to my .mdb file.

I hope it helps.

Friday, February 17, 2012

Cyrstal Management Console

Hi

Once I upload my report to Crystal enterprise and i do preview of that report i can see the print button in the crystal tool bar. But once i call the report via query string from my application that print button disappears! Can some one help me with that issue! that how i can get the print button enable for the reports which are being called from query strings!

ThanksCR.EnablePrintButton=True

CR is the Crystal Report Viewer|||Thanks for the reply but.. here is the problem..

I am using URL reporting on Crystal enterprise

http://webserver/crystal/enterprise10/ePortfolio/en/viewrpt.cwr?id=10000&apsuser=user&apspassword=password&apsauthtype=secEnterprise&promptex-CompanyName=ABC Company&promptex-CompanyAddress=123 Main Street&promptex-CompanyCSZ=New Orleans LA

Is there anyway we can pass query string parameter?!

Let me know
Thanks|||I finally found the solution!!
The URL you are utilizing to interface is calling the DHTML viewer which does not include that by default. If you want to utilize the ActiveX viewer, you can try adding the "&init=actx" to the end of your querystring, however depending on how you're interfacing with the report this may or may not work. If it doesn't work (i.e. different .NET interface methods) you will need to change some parameters in the code, which I'm not sure exactly what it is but do a search on support site for the help file for Report Viewers and the full object model is listed there.

Tuesday, February 14, 2012

Customizing Report manager

Hi,
I want to add a new button to Report Manager toolbar and add some
functionality to it.
Can anyone suggest me how to do this.On Jul 31, 6:50 am, Deepya <Dee...@.discussions.microsoft.com> wrote:
> Hi,
> I want to add a new button to Report Manager toolbar and add some
> functionality to it.
> Can anyone suggest me how to do this.
Unfortunately, this type of functionality does not exist. To achieve
this, you will want to create a custom ASP.NET application. Sorry that
I could not be of greater assistance.
Regards,
Enrique Martinez
Sr. Software Consultant