|
Respect TDDragon
First of all thanks a lot for having look at my post & reply and second sorry for late
As U said i checked all things
1>The dataset is full of data
2>In design view the report shows dummy data in preview report
3>I used your code but i m little confuse boz in your code where i should use the dataset (U used database)?
<br />
Private Sub print_me()<br />
Try<br />
Dim sql As String = ""<br />
Me.cnn.Open()<br />
' sql=Query<br />
ad = New SqlDataAdapter(sql, cnn)<br />
ad.SelectCommand.CommandType = CommandType.Text<br />
Me.ds = New DataSet<br />
ad.Fill(ds)<br />
Me.cnn.Close()<br />
<br />
Dim rd, new_rd As New CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
rd.Load(Application.StartupPath + "\CrystalReport1.rpt")<br />
<br />
rd.SetDataSource(Me.ds)<br />
new_rd = Me.reconnectreport(rd)<br />
<br />
Catch ex As Exception<br />
MessageBox.Show(ex.ToString, "Crystal", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
Me.cnn.Close()<br />
End Try<br />
End Sub<br />
<br />
Private Function reconnectreport(ByVal report As CrystalDecisions.CrystalReports.Engine.ReportDocument) As CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
Dim rpt As New CrystalReport1<br />
rpt = reconnectreport(rpt)<br />
<br />
Dim connection As CrystalDecisions.Shared.IConnectionInfo<br />
Dim oldServerName As String = report.DataSourceConnections(0).ServerName<br />
Dim newServerName As String = "SYSTEM2"<br />
Dim oldDatabaseName As String = report.DataSourceConnections(0).DatabaseName<br />
Dim newDatabaseName As String = "xcpa"<br />
Dim userID As String = "sa"<br />
Dim password As String = ""<br />
report = report<br />
' Change the server name and database in main reports<br />
For Each connection In report.DataSourceConnections<br />
If (String.Compare(connection.ServerName, oldServerName, True) = 0 _<br />
And String.Compare(connection.DatabaseName, oldDatabaseName, True) = 0) Then<br />
' SetConnection can also be used to set new logon and new database table<br />
report.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection( _<br />
newServerName, newDatabaseName, userID, password)<br />
End If<br />
Next<br />
' Change the server name and database in subreports<br />
Dim subreport As CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
For Each subreport In report.Subreports<br />
For Each connection In subreport.DataSourceConnections<br />
If (String.Compare(connection.ServerName, oldServerName, True) = 0 _<br />
And String.Compare(connection.DatabaseName, oldDatabaseName, True) = 0) Then<br />
' SetConnection can also be used to set new logon and new database table<br />
subreport.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection( _<br />
newServerName, newDatabaseName, userID, password)<br />
End If<br />
Next<br />
Next<br />
Return report<br />
End Function<br />
But it gives error that:-
An unhandled exception of type System.StackOverflowException' occurred in CrystalDecisions.CrystalReports.Engine.dll
I think i have missed something
Thanks a lot once again
|
|
|
|
|
the reconnectreport function only reconnects your report to the database so it doesn't set the datasource
best practice is too reconnect the report first and then set the datasource (if needed)
~V~ wrote: rd.SetDataSource(Me.ds)
new_rd = Me.reconnectreport(rd)
becomes:
new_rd = me.reconnectreport(rd)
new_rd.setdatasource(me.ds)
wether or not you need to set the datasource depends on how you designed your report.
If you designed it against a real database using the table structure and such and you don't need to add additional filters then you shouldn't have to set the datasource but if you do need to add additional filters it is somethimes easer to set the datasource with a new sql statement.
example:
you have a report that connects to 2 tables (table1 and table2)
all you want to do is to show the data from the 2 tables without filters
in this case you don't need to do the setdatasource
if you want to show only one record from table1 and the corresponding records from table2
you'd best set the datasource for table1 and table2 in code
On a side note: make sure that the database name,server,username,password you provide in the reconnect function are correct (I suspect you placed dummy data here (as you should)). If these are wrong the report will not connect to the database and most likly crash.
Sorry for the late reply but I was out for the weekend so...
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
Any help would be appreciated
|
|
|
|
|
Sorry to trouble u
But i m facing the same problem after changed the line as u told me
<br />
Private Sub print_me()<br />
Try<br />
Dim sql As String = ""<br />
Me.cnn.Open()<br />
sql = "select a.srno,a.amount,c.name,b.h_name from satrans as a inner join hor as b on a.h_id=b.h_id inner join party as c on a.party_id=c.party_id where a.match_id = 1"<br />
<br />
ad = New SqlDataAdapter(sql, cnn)<br />
ad.SelectCommand.CommandType = CommandType.Text<br />
Me.ds = New DataSet<br />
ad.Fill(ds)<br />
Me.cnn.Close()<br />
<br />
Dim rd, new_rd As New CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
rd.Load(Application.StartupPath + "\CrystalReport1.rpt")<br />
<br />
new_rd = Me.reconnectreport(rd)<br />
rd.SetDataSource(Me.ds)<br />
<br />
Catch ex As Exception<br />
MessageBox.Show(ex.ToString, "Crystal", MessageBoxButtons.OK, MessageBoxIcon.Error)<br />
Me.cnn.Close()<br />
End Try<br />
End Sub<br />
<br />
<br />
Private Function reconnectreport(ByVal report As CrystalDecisions.CrystalReports.Engine.ReportDocument) As CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
<br />
Dim rpt As New CrystalReport1 '### The error occured here<br />
rpt = reconnectreport(rpt)<br />
<br />
Dim connection As CrystalDecisions.Shared.IConnectionInfo<br />
Dim oldServerName As String = report.DataSourceConnections(0).ServerName<br />
Dim newServerName As String = "SYSTEM2"<br />
Dim oldDatabaseName As String = report.DataSourceConnections(0).DatabaseName<br />
Dim newDatabaseName As String = "xcpa"<br />
Dim userID As String = "sa"<br />
Dim password As String = ""<br />
report = report<br />
' Change the server name and database in main reports<br />
For Each connection In report.DataSourceConnections<br />
If (String.Compare(connection.ServerName, oldServerName, True) = 0 _<br />
And String.Compare(connection.DatabaseName, oldDatabaseName, True) = 0) Then<br />
' SetConnection can also be used to set new logon and new database table<br />
report.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection( _<br />
newServerName, newDatabaseName, userID, password)<br />
End If<br />
Next<br />
' Change the server name and database in subreports<br />
Dim subreport As CrystalDecisions.CrystalReports.Engine.ReportDocument<br />
For Each subreport In report.Subreports<br />
For Each connection In subreport.DataSourceConnections<br />
If (String.Compare(connection.ServerName, oldServerName, True) = 0 _<br />
And String.Compare(connection.DatabaseName, oldDatabaseName, True) = 0) Then<br />
' SetConnection can also be used to set new logon and new database table<br />
subreport.DataSourceConnections(oldServerName, oldDatabaseName).SetConnection( _<br />
newServerName, newDatabaseName, userID, password)<br />
End If<br />
Next<br />
Next<br />
Return report<br />
End Function <br />
Error is:-
<u>An unhandled exception of type System.StackOverflowException' occurred in CrystalDecisions.CrystalReports.Engine.dll</u>
Thanks once again
modified on Wednesday, December 19, 2007 6:13:21 AM
|
|
|
|
|
I have a datagridview combobox column that needs to load a list of sorted "PRODUCTs". But when i try to sort the products. it gives me error saying that
Datagridview column cannot be sorted..!
any suggestions or way out?
:- Rashid Ali -:
|
|
|
|
|
I want to change the color of all text that i given in inutbox .But when i write code for that ,it chage the first maching word not all.
My code is
richtextbox1.selectionstart=richtextbox1.find(value) 'value contains the selected text
richtextbox.selectioncolor=colordialog1.color
I use inputbox for selecting that word .If the richtext box contains that word change the forecolor.But when i using the above code it chage only first selected maching word.
|
|
|
|
|
You've found the first instance of the text, and you've changed it. You need to step through and find the others, to change those too.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Want help to know how to read pdf file content using visual basic 6.
|
|
|
|
|
Wow - why are you using VB6 ? VB6 was only ever useful because of the C++ components it could use to do real work. You need to find someone who still sells VB6 components, and buy one to read PDFs.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have a bigest project in my life. I develop it using VB.NET.
My project can saperate into many part here:
- client-user account
- customer account
- material account
- store
- point-of-sell (storefront)
- purchasing cycle
- and accounting
In the store and point-of-sell parts I need to use barcode reader and I need to generate barcode label by myself but I can't find any resource about barcode format and generating
If anyone can help me through this problem or can point me to any resource, I would thank you very much.
------------------------------------
my e-mail: s_thamvarodom@hotmail.com, s_thamvarodom@yahoo.com
(Thailand, Asia)
T. Sittichai
|
|
|
|
|
http://www.codeproject.com/info/search.aspx?artkw=barcode+format+and+generating&sbo=kw[^]
You can call C# dlls from VB.NET.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you for your guide but when I follow the link to search, it found only one article and it's not the one that you specific me to read, please show me the url to the right article.
Thank you again.
S. Thamvarodom
|
|
|
|
|
sitt wrote: I need to generate barcode label by myself but I can't find any resource about barcode format and generating
If you didn't find anything, it's because you either didn't search at all, or your eyes were closed when the search results came up.
Google for generate barcode in vb.net[^]
|
|
|
|
|
Hey, I ask you for a help not for a complain but thank you for your response.
First of all I'm newly in microsoft technologies and I never learn for the barcode technology before and I need to implement it for my project but I spent my time for about 6 hours to find topics about barcode on the internet, I searched on google but when result came up it's only commercial product advertising, I tried not I didn't find. I accept that I'm not smart but at least I'm try to get it successed so I ask you to help me.
modified on Sunday, December 16, 2007 9:47:46 PM
|
|
|
|
|
sitt wrote: First of all I'm newly in microsoft technologies and I never learn for the barcode technology before
The problem has nothing to do with either. If you want to successfully write code, no matter the language or technology, the single most important skill you must have nothing to do with programming. It's the ability to do research. How to find information using, and refining the correct search terms, how to hypothesize, and how to test those hypothesis. If you don't know this skill - learn it. It's far more useful than knowing how to write code.
|
|
|
|
|
|
All you need is font, and calculate check digit when forming the bar code (ie Code+CheckDigit).
And I _assume_ that, as you might be printing bar code labels to be pasted on products, and the labels might not be large enough to be scanned, if you use a normal printer, you should get a bar code printer instead. The ways of configuring the bar code printer should come with the bar code printer.
To use the barcode reader, you don't usually need to do much else, as the reader acts as a keyboard. Just make the cursor is on the capturing control (textbox) and the barcode is of correct code.
|
|
|
|
|
Thank you very much, I got the concept. Now, I'm getting barcode fonts and paper about how to generate checking digit (I got it from one article about barcode in this website and he posted the URL to find out how to generate barcode checking digit) and I will implement it.
Thank you.
S. Thamvarodom
modified on Sunday, December 16, 2007 9:46:45 PM
|
|
|
|
|
CodeProject holds over 30 articles on barcodes, some use special fonts, some draw
the lines themselves.
in 6 hours you could have read all of them.
|
|
|
|
|
I have a dll file can be linked with VB 6.0. In VB 2005, I tried to use "Add Reference" to link the dll, but I got an error for checking if the file is assembly or COM components. Can I do "Declare" like VB 6.0 to call functions in dll?
VB 6.0->
Public Declare Function Cmod2WireWriteBlock _
Lib "cmodcomm.dll" _
(ByVal DeviceAddr8 As Integer, _
ByRef InBuffer() As Char, _
ByVal BUFSIZEcount As Integer) _
As Boolean
|
|
|
|
|
Add reference is only good for COM or .NET dlls. p/invoke may work.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Heya,
Just a quick question. I am writing a stack application in which there is one requirement that data structure must make use of a block of memory allocated when the stack is constructed. Now which data stucture is most appropriate for this. Is it sensible to use linked list or not.
ta
James
|
|
|
|
|
I think you should put on your flame-retardant suit.
|
|
|
|
|
A Linked list, by its very nature, is dynamic; you can't use a stack for it.
Unless I'm making a huge mistake (and I've made plenty in the past ), you are going to be stuck with arrays*.
* You _could_ also use fixed-size stacks and queues and dequeues, but they're just sexed up arrays.
Cheers,
Vikram.
"If a trend is truly global, then that trend ought to be visible across ANY subset of that data" - fat_boy
|
|
|
|
|
|