473,383 Members | 1,984 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,383 software developers and data experts.

Return Empty Datatable

Hi All,

First time I am posting, so please forgive me if I miss out any
information while asking you my question. I have a .net web app that I
am building in 2.0 framework. I have a code-behind file that calls a
method in a business logic class. The method in the class talks to the
database through a database access layer. Through the database access
layer I create a tableadapter through SPs in the database. I need to
return a datatable to the code-behind class for the front layer.
However I do not know how to handle returning an empty datatable in
case I encounter that.

thanks much in advance
<System.ComponentModel.DataObjectMethodAttribute(S ystem.ComponentModel.DataObjectMethodType.Select,
False)_
Public Function MenuControl(ByVal Username As String, ByVal Password As
String) As EFAST.tbl_UsersDataTable
' Create a new datatable instance for the dataset from the getdataby
method
Dim datatableUserLogin As EFAST.tbl_UsersDataTable =
Adapter.GetDataByUsername(Username)
If datatableUserLogin.Count = 0 Then
' no matching record found, return 0 this is where I have the problem
Return Nothing
End If
Dim datarowUserLogin As EFAST.tbl_UsersRow = datatableUserLogin(0)
If some business logic Then
' matching record found, return userid
Return datatableUserLogin
End If
End Function

Dec 13 '06 #1
0 1059

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim | last post by:
In my Win App, I have a datagrid that's bound to a dataset. When the form loads, the datagrid fills. How can I add an empty row to the end of the datagrid during a button click (similar to...
3
by: Baren | last post by:
Hi! I am developing a web project using ASP.NET and VB.NET as code behind. In one page the user attaches files to the list. The same data is shown in the and the max records visible is 4. Now...
2
by: carballosa | last post by:
Hi guys, I need to use a one row datagrid in my asp.net 1.1 application. The data source will contain 1 or 0 entries. When no rows of data are present I want to show an empty row in the datagrid...
0
by: kevin | last post by:
using vs 2003 the csv file has every field value enclosed in double quotes: i.e. no null values Whe using OleDbDataAdapter to read a csv file (I do create the schema.ini file defining all...
1
by: lgalumbres | last post by:
Hi, I have a datagrid on Winform that is bound to a datatable. In essence, what I would like to do is that when a user inputs a number into a textbox control for example 5 then 5 empty rows...
1
by: jobs | last post by:
The below always results in an empty table, when I know the Gridview has rows. Dim dataTable As DataTable = CType(ChargeGridView.DataSource, DataTable) If Not (dataTable Is Nothing) Then ...
3
by: Peter Longstaff | last post by:
Hi All, I am having trouble with my first effort at developing a web service. I have a methods, outlined below which should return a DataTable. public DataTable...
4
by: Joseph Geretz | last post by:
I don't get it. A DataTable can't be returned, but a DataSet can. Yet a DataSet contains one or more DataTables. So obviously a DataTable must be serializable. So why not just let me return a...
4
by: sudhaMurugesan | last post by:
Hi all, I am importing data from excel sheet. i get the data in a datatable. when there are empty rows in excel i am getting empty rows in datatable also. how to remove empty rows? help me...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.