473,466 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

data retrieval with C#

3 New Member
I'm very new to .NET and C# and I'm having trouble retrieving information from a database. I'm trying to return the value of a field ("Name") from a DataTable using the code below, but I get the error message "not all code paths return a value" when I try to build.

Where am I going wrong?

public string GetVenueByID(int id)
{
DataSet1.tblVenueDataTable venue_top = new DataSet1.tblVenueDataTable();
DataSet1TableAdapters.tblVenueTableAdapter venue_top_info = new DataSet1TableAdapters.tblVenueTableAdapter();
venue_top = venue_top_info.GetDataByID(id);

if (venue_top.Count == 0)
{
return "xyz";
}
else
{
foreach (DataSet1.tblVenueRow row in venue_top)
{
return row.Name;
}

}

}
Jul 28 '06 #1
1 1317
Elena
3 New Member
if (venue_top.Count == 0)
{
return "xyz";
}
else
{
if(venue_top.Rows.Count > 0 ){
foreach (DataSet1.tblVenueRow row in venue_top)
{
return row.Name;
}
}

}

}
Jul 28 '06 #2

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

Similar topics

12
by: David Turner | last post by:
Hi All!, Does anyone know a link to a website or know the best way to create a data structure that will pick random elements from itself with assigned probabilities? For example, say I...
9
by: J. Baute | last post by:
I'm caching data in the Application object to speed up certain pages on a website The main reason is that the retrieval of this data takes quite a while (a few seconds) and fetching the same data...
0
by: Redd | last post by:
The following is a technical report on a data modeling project that was recently assigned to me by my professor. I post it so that anyone else who is studying databases and data modeling can have...
0
by: Yadagiri Rao KP | last post by:
I got an assignment usig perl and xml. And I was told to design the database. I'd like to know that how one would structure the data storage and retrieval process on a site which stores a...
7
by: Will | last post by:
On the subject of Data Warehouses, Data Cubes & OLAP…. I would like to speak frankly about Data Warehouses, Data Cubes and OLAP (on-line analytical processing). Has it dawned on anyone else...
10
by: Doug Bell | last post by:
Hi, I have an application that has a "Data Access Class" and "User Interface Class". It is for receiving Purchase Order data from one system and pushing processed transactions to another...
3
by: GP | last post by:
We are connecting to sql server database in the webservices & retrieve the data as dataset from the webservices and load it to the aspx pages ,But we find loading of the aspx pages takes longer...
9
by: kencana | last post by:
Hi all, I am a new bie in SOAP and PHP.I got one question about the data retrieval. I am able to retrieve the data successfully from my database. this is my sql statement: select roadname from...
0
by: JosAH | last post by:
Greetings, Introduction At the end of the last Compiler article part I stated that I wanted to write about text processing. I had no idea what exactly to talk about; until my wife commanded...
0
by: JosAH | last post by:
Greetings, welcome back; above we discussed the peripherals of the Library class: loading and saving such an instantiation of it, the BookMark interface and then some. This part of the article...
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.