|
I'm trying to call a Crystal Report 7 from my Visual Basic 2008 project.
I have used the following codes on my form:
ConInfo.ConnectionInfo.UserID = <user name="">
ConInfo.ConnectionInfo.Password = <password>
ConInfo.ConnectionInfo.ServerName = <server name="">
ConInfo.ConnectionInfo.DatabaseName = <database name="">
For intCounter = 0 To objReport.Database.Tables.Count - 1
objReport.Database.Tables(intCounter).ApplyLogOnInfo(ConInfo)
Next
However, whenever I call it using the code below, I'm still being asked for the login details.
Dim objForm As New frmViewReport
objForm.ViewReport("C:\MyREPORT.RPT", , "@pParam=MyParam")
objForm.Show()
I supply the correct login information (server name, user id, password, database)
but I'm still getting error message "Login Failed. Please try again."
Help anyone? It will be highly appreciated.
BTW, I got the codes also from this site. Maybe I'm just lacking something to make it run.
|
|
|
|
|
At a guess you should be passing objReport to the reportviewer. I think, CR is opening MyReport without creds.
Isn't 7 rather old, I thought CR was up to 11 or 12 by now.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually I am passing it to a reportviewer, but still with logon error.
Yup, CR 7 is really old. I'm upgrading to CR 2008 (for the new reports) and I'm just trying to call the old reports done thru CR 7 so as not to do it all over again on 2008.
|
|
|
|
|
You can not call ANY version of Crystal report under 9 i think from .Net.
Depending on how many reports you have, you can open them all up in CR 08 and save them as the 08 version. I'm about to go through this with about 200 CR 7&8 reports we have from a legacy VB6 app we have.
|
|
|
|
|
You're absolutely correct. I'm currently converting our CR reports to 08 version.
Thanks!
|
|
|
|
|
|
And the problem would be .....??
You should not be doing any database operations inside this method. Setup and execute the database operations outside of this, then maintain the datareader only to read the data and parse it for print. When the printing is done, then you can close the reader.
Oh, and posting IN ALL UPPER CASE IS THE SAME AS YELLING AT THE TOP OF YOUR LUNGS!
|
|
|
|
|
|
You're already doing it. You render just the current page, and if you have more pages to render, you set the e.HasMorePages = True and drop out of the event handler. The PrintPage event will fire again so you can render the next page.
WHen you don't have any more pages to print, you just set e.HasMorePages to False.
|
|
|
|
|
how do i determine whether im exceeding the bottom margin?
Thanx
|
|
|
|
|
That's where you have to keep track of where your drawing your strings and how big they are. Look into Graphics.MeasureString. The margins are given to you in the event args you get from the system in the "e" variable.
|
|
|
|
|
Can you pls fix that in my code of me?
Thanx
|
|
|
|
|
Isn't that what YOU get paid to do??
Besides, from what I'm seeing in your code, it would take a complete rewrite of your printing method, and breaking it down into smaller methods that do very specific things...
|
|
|
|
|
I dont get paid, is a project im com'n up with. Help me out Bro.
|
|
|
|
|
Since I work a fulltime job with overtime, and have 1 year old running around my house afterwards, when am I supposed to do this?
|
|
|
|
|
|
Do you know, if we had two points in degrees on a circle and we wanted to derive an unknown 3rd point in degrees could we do it if we knew that the third point had a known angle to the other two points?
So the three points together make a triangle, as an example ;
Point (1) is on the circle at 30 degrees
Point (2) is on the circle at 90 degrees
Point (3) exists somewhere on the circle and we know that it has a 75 degree internal angle to Point (1) and (2), how can we determine at what degree on the circle point (3) is situated at?
|
|
|
|
|
Hi Cyndy,
once the circle (center O) and two points (A and B) are fixed, you can no longer chose the interior angle at a third point C; that angle is constant, it does not depend on the position of C on the circle at all (assuming you mean the circumference).
Here is a well known example: have A and B at opposite locations (say 0 and 180 degrees), then no matter where C lies, angle ACB will always be 90 degrees.
General proof:
1. the sum of the interior angles of quadrilaterals is always 360
2. in quadrilateral OACB angle ACB (the one you want) equals OAC plus OBC (because the triangles OAC and OBC are isosceles)
3. angle AOB is fixed
4. from 1+2+3 it follows angle ACB is also fixed (and equal to 180 minus half of AOB)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
This is not a Visual Basic Question, insted it's geometry. I normaly start by drawing a note, how the given situation looks like, and then look up my geometry/trigonometry formula sample...
Regards: Didi
|
|
|
|
|
Hi all,
I need to upgrade an existing crystal report. Actually, my report got 2 group header.
I need to add on between the existing header.
All seems to be ok until I print the report.
I've created this new group header using the option "in specific order" and I've then created my "group". I've checked the Repeat Group Header on Each Page for my need.
Problem : when my group is finish, the first group repeat on a new page and print directly the new data for the next group. I just want that the 1st group header is not repeated at the end of the 2nd group header. I've tried many things for formating (suppress blank page, keep group together) but every time it fails.
I'm using Visual Studio 2003
I hope someone can have a great idea to help me. If needed I can give you as many more information as needed if I wasn't clear enough.
Thx
Sybux
|
|
|
|
|
i believe you need to create your own variables to control whether or not you want to have the group heading printed.
1) Create a formula field, "DUMMY0" and enter the following code in it:
Global NumberVar GrpHdgFlag;
GrpHdgFlag = 1;
2) Place this "DUMMY0" formula field in your ReportHeaderSection and supress it from printing.
3) create another formula field, "DUMMY1" and enter the following code in it:
Global NumberVar GrpHdgFlag;
GrpHdgFlag = 0;
4) Place "DUMMY1" in the headersection2 and suppress it from printing.
5) In HeaderSection1, in the Suppression formula section, place the following code:
Global NumberVar GrpHdgFlag;
If GrpHdgFlag = 0 then
true
else
false
6) In the FooterSection2 place the following code:
Global NumberVar GrpHdgFlag;
GrpHdgFlag = 1;
This should control whether or not to print the Group Heading on a new page.
Give it a try.
|
|
|
|
|
Thx for your answer but,
I've got a problem with section 6 !
Where shall I place the code ? I can't find any "code section" in my Report
|
|
|
|
|
Hi,
I'm pretty new to VB, but have been writing a program using VB 2008 Express. I have a section of code that will compile perfectly using VB Studio 2003, but it throws a InvalidCast Exception under VB 2005/2008. The code throws an Invalid Cast exception at [I]KeyHandle = e(field.GetValue(KeyToMonitor)[/I] line below, and as far as I can tell it is because the variable Field is passing the string Microsoft.Win32.SafeHandles.SafeRegistryHandle rather than an integer. Is this because of safe keys in VB 2005 and 2008?
If so, would anyone be able to tell me how to call the handle of the registry key opened in a way compatible with Safe Keys? I'm using the code to notify when a registry key is changed using RegNotifyChangeKeyValue.
<br />
Private Function WaitForChange() As Boolean<br />
Dim notifyEvent As New Threading.AutoResetEvent(False)<br />
Dim KeyHandle As IntPtr<br />
Dim KeyToMonitor As RegistryKey<br />
KeyToMonitor = Registry.CurrentUser.OpenSubKey("Software\Microsoft\MediaPlayer\CurrentMetadata", False)<br />
Dim regKeyType As Type = GetType(RegistryKey)<br />
Dim field As System.Reflection.FieldInfo<br />
field = regKeyType.GetField("hkey", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic)<br />
KeyHandle = CType(field.GetValue(KeyToMonitor), IntPtr)<br />
<br />
Dim err As Integer<br />
err = NativeMethods.RegNotifyChangeKeyValue(KeyHandle, _<br />
True, NotifyFilterFlags.REG_NOTIFY_CHANGE_ATTRIBUTES _<br />
Or NotifyFilterFlags.REG_NOTIFY_CHANGE_LAST_SET _<br />
Or NotifyFilterFlags.REG_NOTIFY_CHANGE_NAME _<br />
Or NotifyFilterFlags.REG_NOTIFY_CHANGE_SECURITY, _<br />
notifyEvent.Handle, True)<br />
<br />
If err = 0 Then<br />
notifyEvent.WaitOne()<br />
RaiseEvent KeyChanged(CObj(Me), New EventArgs())<br />
Return True<br />
Else<br />
Debug.WriteLine(err)<br />
Return False<br />
End If<br />
End Function<br />
|
|
|
|
|
|
you need to describe more of what your doing... there is no way anyone can help you fill in the blanks when that's all you give us.
are all 3 tiers on one machine?
or
are you using webservices/wcf/??????
you said "finished writng the code for all" that seems impossible when one of your tiers should be the ui...
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|