|
Hi ,
I am trying to display a crystal report using the crystal report viewer in vs 2008,and it does not display instead it gives a database login screen.
This is the code which I am using .
==================================================================
CrystalReport1 objRpt;
//Usermaster objRpt;
objRpt = new CrystalReport1();
string connstr = "Persist Security Info=False;userid=btssys; password=xx23;database=bts;server=xxxx";
MySqlConnection mc = new MySqlConnection(connstr);
try
{
mc.Open();
string sql = "select userid,
usergiven,userfamily,status,expiry,created,created_by
from user_master";
MySqlCommand cmd = new MySqlCommand(sql, mc);
MySqlDataAdapter adp = new MySqlDataAdapter(sql, mc);
//new MySqlDataAdapter(
DataSet ds = new DataSet();
int li_rows = adp.Fill(ds, "myds");
if (ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("No data Found", "CrystalReportWithmysql");
return;
}
// Setting data source of our report object
objRpt.SetDataSource(ds);
// Binding the crystalReportViewer with our report object.
crystalReportViewer1.ReportSource = objRpt;
================================================================================
If I debug I can find that the ds is retrieving the rows. But nothing comes up on the crystal report viewer.It displays a database login screen instead with server name as myds. Is this something to do with Mysql or something wrong with VS 2008 or crystal report coding.
Thanks
|
|
|
|
|
Hi all,
I resolved it myself, change the
DataSet ds = new DataSet();
int li_rows = adp.Fill(ds, "myds");
I used a datatable and changed the retrieval to
adp.fille(dt) ;
objRpt.SetDataSource(dt);
and it works
any ways, thanks everyone.
|
|
|
|
|
Hi
i have 3 tables :
Roles (roleId [int], roleName [varchar])
Objects (objectId [int], objectName [varchar])
Permissions (permissionId [int], roleId [int], objectId [int], allowView [bit], allowChange [bit])
Note : Permissions.roleId is foreign key for Roles.roleId
and Permissions.objectId is foreign key for Objects.objectId
in my form, i have :
comboBox to display avialble roles (data come from Roles table)
datagridview to display available objects (data come from Objects table)
two checkBox (View , Change )
i want, when user click on each object in dataGridView, security info for selected Role and object display by two checkBoxes,
but i don't know which dataSource is appropriate for checkBoxes .
Note : i have a DataSet in my app with that 3 tables included with their relationShips ,
but i don't know how to bind this controls to display correct data for each Role and Object.
|
|
|
|
|
I writing some application that in some point i need to get some PDF file and put all the text in the PDF into some Rich Text control.
I don't know how to set the text of the PDF file ....
Thanks for any help.
|
|
|
|
|
What you are proposing is not easy.
There are several open-source PDF Libraries available and I suggest that you Google for 'PDF C#' and do a lot of reading.
When or if you get stuck with some actual code that you have tried, ask again.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have a DayCell usercontrol class, which has a property Date (of type DateTime).
I also have a MonthCal usercontrol which has a collection of DayCells.
Finally, I have a YearCal usercontol which has a collection of MonthCals.
I would like the YearCal to have a DateChanged event which is fired when a DayCell is clicked.
I would like the Date property of the clicked Daycell to be made available to the YearCal client (via an EventArgs-derived parameter).
I could create an event in MonthCal that is subscribed to by YearCal, which then fires the DateChanged event.
There MUST be a more elegant way for the click event and date information to propagate from DayCell to MonthCal to YearCal, but for the life of me, I can't figure it out.
I would be grateful for any suggestions.
Thanks,
tfhain
|
|
|
|
|
Hi,
if your YearCal holds say 12 MonthCals (lets hope it instantiates them by code, not by Visual Designer manipulations), then yes the proper way would be for it to subscribe to each MonthCal's Changed event and act upon it.
It seems like you are creating almost 400 controls to represent one year's worth of calendar.
That is a lot of stuff, and it is bound to paint rather slow, and react sluggish to all kinds of events (Form minimize/maximize/restore, repaints when uncovered, etc). I would recommend a more lightweight approach using maybe only one Control where you do all the painting explicitly, and the keyboard/mouse interaction by explicit code. It will probably result in less code (more hand-written code though) and far better performance.
|
|
|
|
|
In your current set up, that is the correct way IMO.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
HI everyone!!!
Im workin on an application in C#, im stuck up at the login window. I want to sign into my application usin the login window. So, how can i do that usin MS Access. while using the login window it shld check the username and password and then make the user to log in. pls help??
|
|
|
|
|
Start here[^] to read up on implementing user-level security. For more information, see the MS Access section [^]on the Microsoft Office site.
I are troll
|
|
|
|
|
i need to compare tow picture from picturebox
i read the picture from database and i need to ompare from other picture
|
|
|
|
|
You should ask specific questions, and tell us what you did so far to show your knowledge and commitment. Failing that, you will get down-voted and mocked about, as has happened before.
|
|
|
|
|
I have a similar question, Assume we have two Bitmap Images in a C# application, can we compare between them pixel to pixel ?
|
|
|
|
|
There's an article on the subject, right here[^] on CodeProject
--edit--
Forgot to answer the question: Yes, that's possible.
I are troll
|
|
|
|
|
hello good gurus.I've hesitated a lot before posting here coz i've been doing research(some of the articles here are too advanced for me ) but righ now i don't have the choice.it' seems that forum.hibernate.org is pointing to jboss for some reasons i don't know so please...
i'm new to nhibernate and i wanted to do a small application with 3 tables(i use 2 for now).table currency and table country here are the mapping files
<?xml version="1.0" encoding="utf-8" ?>
//country table mapping
<class name="dataprovider.Country,dataprovider" table="country">
<id name="CountryId" column="country_id" unsaved-value="0">
<generator class="native"/>
</id>
<!--<bag name="BatchList" inverse="true" lazy="true" >
<key column="country_id" />
<one-to-many class="Batch" />
</bag>
<bag name="PrinterList" inverse="true" lazy="true" >
<key column="country_id" />
<one-to-many class="Printer" />
</bag>-->
<many-to-one name="CurrencyId" column="currency_id" class="Currency" cascade="save-update"/>
<!--<property column="currency_id" name="Currency_Id"/>-->
<property column="name" name="Name"/>
<property column="region" name="Region" />
<property column="comments" name="Comments"/>
//currency table mapping
<id name="CurrencyId" column="currency_id" >
<generator class="native"/>
</id>
<bag name="CountryList" inverse="true" lazy="true" >
<key column="currency_id" />
<one-to-many class="Country" />
</bag>
<!--<bag name="DenominationList" inverse="true" lazy="true" >
<key column="currency_id" />
<one-to-many class="Denomination" />
</bag>-->
<property column="name" name="Name"/>
<property column="authorizer" name="Authorizer" />
<property column="date_created" name="DateCreated" type="DateTime" not-null="true" />
<property column="comments" name="Comments" />
the many to one relationship that country hold is an attribute of the type Currency in the country persistence class.Now while my test can_add_currency and can_add_country succeeded(i export the schema) i have null value in the table country on the field currency_id. here is the test code
<code>[Test]
public void can_add_new_country()
{
CountryManager cm = new CountryManager();
Country country = new Country();
//country.CurrencyId = CurrencyManager.GetCurrencyById(1);
country.CurrencyId = new CurrencyManager().GetCurrencyById(1);
country.Name = "POUND";
country.Region = "ENGLAND";
country.Comments = "the comment";
cm.Add(country);
using(ISession session = _sessionFactory.OpenSession())
{
Country fromdb = session.Get<Country>(country.CountryId);
Assert.IsNotNull(fromdb);
Assert.AreNotSame(fromdb, country);
}
}
public Currency GetCurrencyById(int currency_id)
{//GetCurrencyById from CurrencyManger class
try
{
using(ISession session = NHibernateHelper.OpenSession())
{
return session.Get<Currency>(currency_id);
}
} catch (Exception ex)
{
return null;
}
}
</code>
so the question is HOW TO INSERT INTO TABLE COUNTRY WITH THE CURRENCY_ID OF AN EXISTING CURRENCY_ID FROM THE TABLE CURRENCY? for example there is a currency with the currency_id=1, i want to insert to the country table and have currency_id=1 in the foreign key that is in country table.How you guys do it?i'm seriously stacked and 2 days small project is taking me one week now.Please have pity thanks for reading
eager to learn
|
|
|
|
|
Could someone please show me an example of how to create a registry entry using an API call to advapi32.dll. Basically make it do what the below .NET statement does.
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\ABCsoft\System\INIT", "SHARELOCATION", "C");
I have heard it can be done but haven't found any sample code to illustrate syntax.
Thank you so much for your time!
|
|
|
|
|
You're in luck: the essential registry functions reside in advapi32.dll
google for RegCreateKey, RegOpenKey, RegSetKeyValue
I stopped using most of them when .NET 2.0 started registry support.
Not sure why you want the trouble of finding the right combination and go through P/Invoke though.
|
|
|
|
|
I need to use the API because I will be having the users run the app from a mapped network drive. And too many users encounter a security exception when doing this. And I don't have the ability to modify the .NET config tool settings. So I have to do it the old fashioned way. Just don't know how format the syntax for those functions. Thanks.
|
|
|
|
|
OK, that is 2 issues:
1. running a networked app
for a .NET app, that could be an issue
2. accessing registry keys
I'm not convinced the old Win32 registry function would work when the .NET Registry class would prevent you from accessing the regkeys. And I expect it will be more strict on the latest Win versions (Vista, 7).
Are you saying you want to create a native app? didn't think so since you asked in this forum, C# is always managed and .NET
|
|
|
|
|
Thanks for your reply. Because the default setting for .NET is to prohibit writing to the registry when being run from a mapped drive. And I can't change .NET settings. I'm being forced to call API's. I know the API and function to use. Just not sure on how to use it. I know this can be done because I've run across web pages Calling API functions using C# that show it. So no, I don't want a native app. Just a Managed one that ALSO uses non managed code. The closest I've come is this --> http://pinvoke.net/default.aspx/advapi32.RegSetValueEx[^] but I'm still lost even with it. Thanks
|
|
|
|
|
I'm sorry to say but that article dates back 2001, it uses .NET 1.0 and AFAIK it's only reason of existence is .NET 1.0 did not have the Registry classes.
I doubt very much it will succeed in writing registry entries where normal .NET Registry classes (in existence since 2.0) would fail. However you can try that by downloading and running its code I guess.
|
|
|
|
|
OK, Thanks Luc. I didn't notice the date. I'll have to come up with another idea. But thanks for all your help.
|
|
|
|
|
you're welcome.
|
|
|
|
|
...with security issues like this though I can see why old timers are unwilling to try managed code.
|
|
|
|
|
It all depends. Do you want any EXE on a network, when double-clicked to start running and potentially delete your disk's content, change your registry, etc.
Microsoft is finally taking major steps in increasing security:
- .NET has its default permissions set low for all but the local drives;
- Vista (and Win7) are much more strict on file system and registry access;
- etc.
It is about time, if you ask me.
And yes, there is some pain since we got used to the more/too relaxed situation that existed till now.
|
|
|
|