|
Hi. I'm rather new to asp.net and even more so in crystal. Basically this is the first time I'm using this. What I need to do is prepare a report from a dynamically created dataset(untyped if you will). I have read a lot of articles online but haven't been able to make it work.
Basically the table that i want to display in crystal doesn't exist in database and was created programmatically as a DataTable
The data simply doesn't display.Here's the code in codebehind:
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
Dim rpt As New ReportDocument
rpt.Load(Server.MapPath("CrystalReport1.rpt")
rpt.SetDataSource(dset.Tables("Tab1"))
CrystalReportViewer1.ReportSource = rpt
CrystalReportViewer1.DataBind()
End Sub
Please note that the dataset is populated correctly as i can see it in a gridview. CrystalReport1.rpt uses the same schema as Tab1 but using a dataset included at design time called "DataSet1".
Here is the code for how this dataset was created:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim mysqlDad As MySqlDataAdapter
Dim mysqlConn As MySqlConnection
Dim query As String = "" 'some select query that returns 2 rows.
Dim connstring As String = "Database=ocsweb;Data Source=10.135.158.160;User Id=abc;Password=abc"
dset = New DataSet("Home")
dset.ReadXmlSchema(Server.MapPath("~\App_Code\DataSet1.xsd"))
mysqlConn = New MySqlConnection(connstring)
mysqlDad = New MySqlDataAdapter(query, mysqlConn)
mysqlDad.Fill(dset, "Tab1_tmp")
Dim Dt As New DataTable("Tab1")
Dim col1 As New DataColumn("Unchecked")
Dim col2 As New DataColumn("Checked")
Dt.Columns.Add(col1)
Dt.Columns.Add(col2)
Dim dr As DataRow = Dt.NewRow()
dr.Item(0) = dset.Tables("Tab1_tmp").Rows(0).Item(0)
dr.Item(1) = dset.Tables("Tab1_tmp").Rows(1).Item(0)
Dt.Rows.Add(dr)
dset.Tables.Add(Dt)
catch ex as exception
msgbox(ex.message)
end try
If there is something else that can/needs to be done, please let me know. I'm very new and could surely use some help here.
modified on Friday, August 28, 2009 6:18 AM
|
|
|
|
|
Try with button click event instead of pageload to bind the dataset to report and see
|
|
|
|
|
hi guys
I have some problem in inserting non english values in AJAX method (in AJAX i send information on get method)
my DB column type is : "ntext" (to allow non english)
i checked , i get right data on server , but wrong data would inputed to the DB !!!
some code is like that :
string res = Request["amount"].ToString() + "," + Request["price"].ToString() + "," + Request["year"].ToString() + "," + Request["month"].ToString() + "," + Request["day"].ToString() + "," + Session["code"].ToString() + "," + Request["kind"].ToString() + "," + "1" + ",'" + Request["comment"].ToString()+ "'";
string str = "INSERT INTO invest (amount,totalprice,year,month,day,personID,typeID,canedit,cms)VALUES(" + res + ")";
SqlDataSource1.InsertCommand = str;
SqlDataSource1.Insert();
Response.Write("اطلاعات وارد شد");
Response.End();
|
|
|
|
|
check if the datatype of the column nvarchar?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
it is ntext , i changed it to nvarchar(MAX) to see if gets better , but didn`t came true !!
|
|
|
|
|
is it possible to add scrollbar to a datagridview???
|
|
|
|
|
Place gridview inside a panel or div and give scroll to that container.
|
|
|
|
|
i placed the gridview inside the panel and set overflow: auto in panel style.But the scroll bar is coming for the whole page as such
|
|
|
|
|
Gave Width & Height for Panel?
|
|
|
|
|
Try setting Width and Height for Panel if not set.
|
|
|
|
|
No..it is coming now...thanks arun
|
|
|
|
|
myinstincts wrote: No..it is coming now...thanks arun
great.welcome.
|
|
|
|
|
by using div or panel you can acheive that...
Panel:
<asp:Panel id="divGrid" ScrollBars = Vertical runat=server style="OVERFLOW-Y: auto; overflow-x:hidden; HEIGHT:200PX; width:80%">
Div:
<div id="divGrid" runat="server" nowrap="nowrap" style="OVERFLOW-Y: auto; overflow-x:hidden; HEIGHT:170PX; width:80%">
|
|
|
|
|
i am getting it by setting overflow :auto style in panel...but what is that overflow-x and overflow-y in your code?is it for setting scrollbar to x and y axis?
|
|
|
|
|
Hello all,
In my web apllication , i divided the screen in to three parts by using div, in each div i am loading some html pages with more controls . in one of my event i loading a html pages. when i trigger the event more number of times the memory using is increaced continoulsy .
what should i do to clear the previous loaded pages contols in the div
|
|
|
|
|
Hello all,
I am using SqlDataSource to configure GridView in my application.
I am using Editing, delting and inserting features of GridView to update my database.
My problem is while specifying DakaKeyName in SqlDataSource, i don't have any primary key in my table.
It is a table in which are referring primary keys of two table. So, the two foreign keys will make up a primary key for my table.
Can anybody tell me how can i put DataKeyName in SqlDataSource by making a primary key from combination of two foreign keys.
Thanks,
Nagendra.
|
|
|
|
|
Hi,
I am developing a web based application using Asp.net and C#. We are using Microsoft Outlook Express, I need same user and password should have access to application and once if any user changes his/her exchange password it should automatically reflect to my web application.
This will help my user to keep the same user and password for exchange and web applications.
required urgent solution and if possible some code snippet.
Thanks in advance.
Regards,
Sadanand
|
|
|
|
|
I think you can use Windows Authentication for your application.
|
|
|
|
|
Plz can Anyone give me the code for implementing A horizontal Slider having two handles giving range of value in Asp.Net in VB
|
|
|
|
|
|
|
Hello, This is Vikash Gohil.
I have a DropDownList on my Webpage which displays numbers from 1 to 31.
When i open the page and click this dropdownlist, it display all the items in list at once, ie it displays a Long List with all the items in it getting displayed.
I don't want this and want to show on 10 items in the dropdown and a scroll bar to scroll down for other items.
Could any one please help me.
Thanks in Advance.
Awaiting a reply soon.
|
|
|
|
|
|
Thanks for the reply.
Will try with my Own Control
|
|
|
|
|