473,379 Members | 1,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Reporting from DataTable

294 256MB
I have a DataTable that is populated from SELECT queries based on the parameters a user enters into text boxes. (First Name, Last Name or both)

I decrypt the values in the DataTable by using this code:
Expand|Select|Wrap|Line Numbers
  1.         Try
  2.             For i As Integer = 0 To dt.Rows.Count - 1
  3.                 dt.Rows(i)("FIRST_NM_TXT") = clsEncrypt.DecryptData(dt.Rows(i)("FIRST_NM_TXT"))
  4.                 dt.Rows(i)("LAST_NM_TXT") = clsEncrypt.DecryptData(dt.Rows(i)("LAST_NM_TXT"))
  5.             Next
  6.         Catch ex As Exception
  7.             MessageBox.Show("Either the first name or last name did not match. Please check your spelling.")
  8.         End Try
How can I use the information inside the DataTable to create a report? The values must be decrypted.

I have done some researching and I am confused as to why so many people use DataSets as opposed to DataTables. DataSets are a collection of Tables, are they not?

Should I first be converting the DataTable into a DataSet, and then using that?

Here is my code that populates the DataTable.
Expand|Select|Wrap|Line Numbers
  1.  SqlCommand.Connection = SQLConnection 'Assigns connection to the command
  2.  
  3.  
  4.  
  5.         If SearchFirsttxt.Text = "" Then
  6.             SqlCommand.CommandText = "Select * FROM PARTICIPANT WHERE LAST_NM_TXT = '" & eLast & "';"
  7.         ElseIf SearchLastTxt.Text = "" Then
  8.             SqlCommand.CommandText = "Select * FROM PARTICIPANT WHERE FIRST_NM_TXT = '" & eFirst & "';"
  9.         ElseIf SearchFirsttxt.Text IsNot Nothing And SearchLastTxt.Text IsNot Nothing Then
  10.             SqlCommand.CommandText = "Select * FROM PARTICIPANT WHERE FIRST_NM_TXT = '" & eFirst & "' and LAST_NM_TXT = '" & eLast & "';"
  11.         Else
  12.             SqlCommand.CommandText = "Select * FROM PARTICIPANT;"
  13.         End If
  14.  
  15.  
  16.         Dim myAdapter As New SqlDataAdapter(SqlCommand) 'holds the data
  17.         myAdapter.Fill(dt) 'datatable that is populated into the holder (DataAdapter)
  18.         DataGridView1.DataSource = dt 'Assigns source of information to the gridview (DataTable)
Thanks!
Feb 3 '14 #1
0 812

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jez123456 | last post by:
Hi My users, use ms access for querying and reporting on a backend database, however they need to replace ms access with a new reporting tool. I’m thinking of developing my own reporting...
6
by: Jason | last post by:
Is it possible to store an entire datatable/dataset in session state? If so, could someone please provide a code snippet or a link to documentation for me please? (I'm having no luck at all) ...
8
by: Woody Splawn | last post by:
I am asking this question here because I asked this question in the Reporting Services Newsgroup and did not get an answer. Does anyone know if Reporting Services is intended to work in a...
2
by: Roy | last post by:
Hi all, I do have a datatable that looks like: id Number Description 1 1 Desc1 2 1 Desc2 3 2 Desc3 I need this datatable looks like (with 4 rows...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
1
by: rmk | last post by:
How can I get the 2000 and 2005 versions of SQL Server Reporting Services both working on my development laptop ????? I have ASP.NET 1.1 and 2.0 installed on my laptop. I have Visual Studio...
0
by: YellowFin Announcements | last post by:
Whitepaper: "Yellowfin Reporting" enables Embedded Business Intelligence -------------------------------------------------------------------------------- Embedded reports are a standard...
7
by: matt | last post by:
hello, i have been given a challenging project at my org. i work on an inventory management web application -- keeping tracking of parts assigned to projects. in the past, i built an in-house...
2
by: J.Marsch | last post by:
All: I am having a problem with Microsoft Reporting Services. I am running a local report (RDLC) on ASP.Net. Running the report obviously can use a lot of memory because it must consume...
19
by: cj2 | last post by:
#1 Is there a quick way to export a datatable to an excel file? Or delimited file? #2 Where is the appropriate Microsoft monitored group to ask about writing reports in SQL Reporting services...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.