database report  
Author Message
medel





PostPosted: Visual Basic General, database report Top

hello,

i'm using ADODB on my vb8-access. before on vb6 i use data report designer to prepare a print, but here on vb8, how can i do that, without using crystal reports i would like to design my report just like report designer, is it possible or are there any turn around for this

thanks


Visual Basic1  
 
 
Andrej Tozon





PostPosted: Visual Basic General, database report Top

Hi,

have you considered using ReportViewer control (more info here and here) There's also a bunch of similar 3rd party solutions available...

Andrej



 
 
medel





PostPosted: Visual Basic General, database report Top

hello,

thanks for your reply, i think this is what i'm looking for, but one more thing, do you have any sample for Access-based and not SQL-Server based and also in VB8 language, the samples i got is in C#



 
 
medel





PostPosted: Visual Basic General, database report Top

is Report Viewer exclusive for SqlServer2005 only

 
 
Andrej Tozon





PostPosted: Visual Basic General, database report Top

ReportViewer works with datasets so I don't see why it wouldn't work with Access databases. Just fill your datasets with data from Access and it should work. There isn't much C#/VB code when using ReportViewer, since most of the work is done in the designer (selecting fields, regions, etc.). The only necessary code is to get the data into your datasets (by e.g. using TableAdapters)...

Andrej



 
 
medel





PostPosted: Visual Basic General, database report Top

hello,

i've tried filling my dataset with access data but it only accepts sql server file. can you help me with this please



 
 
Andrej Tozon





PostPosted: Visual Basic General, database report Top

Hi again,

these are the steps I've just took to create a new report project from scratch, using Access database as a data source. Hope you find them useful. If any of them are unclear, please post your further questions here.

I. Add Access database as a new data source

1. Menu: Database | Add New Data Source
2. Database, Next
3. New Connection
4. Microsoft Access Database File, Continue
5. Browse, select your access .mdb file, OK
6. Next
7. Yes
8. Next
9. Select your tables and/or views, Finish

The dataset should now be successfully created. You can check it through Data Sources window (Menu: Data | Show Data Sources).

II. Add the ReportViewer Control and design the report

1. Open new project
2. Create/Open new form.
3. Drag the ReportViewer control on the form and dock it in the parent container (Dock = Fill).
4. Through ReportViewer's Smart Tag, select Design a new Report - the Report designer opens up.
5. Menu: Report | Data Sources.
6. Select your table/view in the Project data sources combo and click Add to Report, OK
7. Design your report by dragging your fields from the Data Sources window (many other options are available as well)
8. Save your report and return to your form.
9. Through ReportViewer's Smart Tag, select Choose your report and select the report you just created. After doing this, Visual Studio should create some controls (DataSet, BindingSource, TableAdapter) and code (look in your form's Load event handler) for you.
10. This should be it. Run your project.
[No manual coding was necessary... All work was done by Visual Studio.]

Andrej



 
 
medel





PostPosted: Visual Basic General, database report Top

hello,

i follow your suggestion about creating new connection, when i select Microsoft Access Database File, i got this error

Format of the initialization string does not conform to specification starting at index 0.


i cant go through from here, i cannot go to selection of Access File. any reason for this

 
 
Andrej Tozon





PostPosted: Visual Basic General, database report Top

Hi,

I can't really say what's the reason for this error [VS/setup issue ], but you can look into this thread, discussing this very same problem, for possible solutions [registry tweaking, see pages 3 and 4 of that thread]...

Andrej



 
 
medel





PostPosted: Visual Basic General, database report Top

hello,

i found a way to add Access data, its though ODBC DNS. i've made a connection, created my dataset, and when i run the program, i got an invalid password error. i already supplied the password on my connection. the error is on

Me.RolesTableAdapter.Fill(Me.DataSet1.Roles)

i'll try to post whatever happens later

 
 
medel





PostPosted: Visual Basic General, database report Top

hi,

im able to create a dataset now, but i've notice that the sql is inside the dataset, how am i able to insert a query like this

select * from roles where roles='" & txtroles.text & "' and remarks='" & cbrem.text & "'

is it possible also i still have problem connecting to access with password on it


thanks again sir

 
 
Andrej Tozon





PostPosted: Visual Basic General, database report Top

here (or start from here).

Andrej



 
 
medel





PostPosted: Visual Basic General, database report Top

thanks again, sir is there any codes or ready sample project in which i can study i cant find any sample from the link you give. thank you again

 
 
Andrej Tozon





PostPosted: Visual Basic General, database report Top

I guess you'll find plenty of VB samples in this 101 VS Samples page. Look under Data Access Samples.

Andrej



 
 
medel





PostPosted: Visual Basic General, database report Top

thank you for the link,the samples were SQL Server based, and as of now i'm having problem making a connection with sql server, but i'll retry again.